Skip to content

Commit 95e3c60

Browse files
committed
fix: better test output
1 parent e28f318 commit 95e3c60

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/tagstudio/qt/mixed/migration_modal.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def color_value_conditional(self, old_value: int | str, new_value: int | str) ->
519519
color = green if old_value == new_value else red
520520
return str(f"<b><a style='color: {color}'>{new_value}</a></b>")
521521

522-
def check_ignore_parity(self) -> bool:
522+
def assert_ignore_parity(self) -> None:
523523
compiled_pats = fnmatch.compile(
524524
ignore_to_glob(
525525
Ignore._load_ignore_file(
@@ -529,11 +529,16 @@ def check_ignore_parity(self) -> bool:
529529
PATH_GLOB_FLAGS,
530530
) # copied from Ignore.get_patterns since that method modifies singleton state
531531
path = self.json_lib.library_dir / "filename"
532-
out = False
533532
for ext in self.json_lib.ext_list:
534-
out &= compiled_pats.match(str(path / ext)) == self.json_lib.is_exclude_list
535-
out &= compiled_pats.match(str(path / ".not_a_real_ext")) != self.json_lib.is_exclude_list
536-
self.ext_parity = out
533+
assert compiled_pats.match(str(path / ext)) == self.json_lib.is_exclude_list
534+
assert compiled_pats.match(str(path / ".not_a_real_ext")) != self.json_lib.is_exclude_list
535+
536+
def check_ignore_parity(self) -> bool:
537+
try:
538+
self.assert_ignore_parity()
539+
self.ext_parity = True
540+
except AssertionError:
541+
self.ext_parity = False
537542
return self.ext_parity
538543

539544
def check_field_parity(self) -> bool:

tests/test_json_migration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ def test_json_migration():
4242
assert modal.check_color_parity()
4343

4444
# Extension Filter List ====================================================
45-
assert modal.check_ignore_parity()
45+
modal.assert_ignore_parity()

0 commit comments

Comments
 (0)