11""" conftest.py """
22import sys
33import warnings
4+ from difflib import Differ
45from pathlib import Path
56from typing import Iterator
67
@@ -59,13 +60,14 @@ def verify_output_str(output: str, filename: str) -> None:
5960 with open (filename , encoding = "utf-8" ) as output_file :
6061 expected = output_file .read ()
6162 if output != expected :
62- print (f"Expected: \n { expected } \n Got: \n { output } " )
63+ print (" \n " . join ( Differ (). compare ( output . splitlines (), expected . splitlines ())) )
6364 assert output == expected
6465 for category in (ColumnSettings .NUM_PARAMS , ColumnSettings .MULT_ADDS ):
6566 assert_sum_column_totals_match (output , category )
6667
6768
6869def get_column_value_for_row (line : str , offset : int ) -> int :
70+ """Helper function for getting the column totals."""
6971 col_value = line [offset :]
7072 end = col_value .find (" " )
7173 if end != - 1 :
@@ -80,6 +82,7 @@ def get_column_value_for_row(line: str, offset: int) -> int:
8082
8183
8284def assert_sum_column_totals_match (output : str , category : ColumnSettings ) -> None :
85+ """Asserts that column totals match the total from the table summary."""
8386 lines = output .replace ("=" , "" ).split ("\n \n " )
8487 header_row = lines [0 ].strip ()
8588 offset = header_row .find (HEADER_TITLES [category ])
0 commit comments