Skip to content

Commit e41df5f

Browse files
committed
Refactor file comparison in YAML config test
Simplifies the file comparison logic in TestParseYAMLConfig by building the actual_files list with explicit handling of directory_label, improving readability and maintainability.
1 parent f4d16cb commit e41df5f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/unit/test_cli.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,15 @@ def test_full_input(self):
2626
assert cli_input.dataverse_url == "https://demo.dataverse.org/"
2727
assert cli_input.persistent_id == "doi:10.70122/XXX/XXXXX"
2828

29+
actual_files = []
30+
for file in cli_input.files:
31+
if file.directory_label:
32+
actual_files.append((file.directory_label, file.file_name))
33+
else:
34+
actual_files.append(("", file.file_name))
35+
2936
assert len(cli_input.files) == 2
30-
assert sorted(
31-
[(file.directory_label, file.file_name) for file in cli_input.files]
32-
) == sorted(expected_files)
37+
assert sorted(actual_files) == sorted(expected_files)
3338

3439

3540
class TestCLIMain:

0 commit comments

Comments
 (0)