Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed May 23, 2024
1 parent 8ffeb2b commit 92abe49
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ geouned_cadtocsg = "geouned.GEOUNED.scripts.geouned_cadtocsg:main"

[tool.black]
line-length = 128
exclude = '(tests/regression_test_files/.*|tests/regression_test_files)'

[tool.setuptools_scm]
write_to = "src/_version.py"
Expand Down
16 changes: 11 additions & 5 deletions tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def test_with_relative_tol_true():
)
geo.start()


@pytest.mark.parametrize("input_step_file", step_files)
@pytest.mark.parametrize("suffix", suffixes)
def test_new_mc_files_match_original(suffix, input_step_file):
Expand All @@ -236,15 +237,20 @@ def test_new_mc_files_match_original(suffix, input_step_file):
"""

# sets up an output folder for the results
regression_test_file = Path("tests/regression_test_files") / input_step_file.parts[-2] / Path(input_step_file.stem) / Path(input_step_file.name).with_suffix(suffix)
regression_test_file = (
Path("tests/regression_test_files")
/ input_step_file.parts[-2]
/ Path(input_step_file.stem)
/ Path(input_step_file.name).with_suffix(suffix)
)
output_filename = Path("tests_outputs") / input_step_file.with_suffix("") / Path(input_step_file.stem).with_suffix(suffix)

with open(output_filename, 'r') as f:
with open(output_filename, "r") as f:
file_new = f.readlines()
with open(regression_test_file, 'r') as f:
with open(regression_test_file, "r") as f:
file_original = f.readlines()
for line_new, line_original in zip(file_new, file_original):
# this lines in the output files are not expected to match as they have the creation data and time
if ' Creation Date' not in line_new and ' Creation Date' not in line_original:
# this lines in the output files are not expected to match as they have the creation data and time
if " Creation Date" not in line_new and " Creation Date" not in line_original:
assert line_new == line_original
assert len(file_new) == len(file_original)
2 changes: 1 addition & 1 deletion tests/update_regression_test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@
)

for suffix in suffixes:
assert output_filename_stem.with_suffix(suffix).exists()
assert output_filename_stem.with_suffix(suffix).exists()

0 comments on commit 92abe49

Please sign in to comment.