diff options
Diffstat (limited to 'tests/test_taxonomy.py')
| -rw-r--r-- | tests/test_taxonomy.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_taxonomy.py b/tests/test_taxonomy.py index a10531b..b5f48e9 100644 --- a/tests/test_taxonomy.py +++ b/tests/test_taxonomy.py @@ -2,6 +2,7 @@ import pytest from pathlib import Path from core.taxonomy import TaxonomyModel, load_taxonomy, save_taxonomy +from ui.taxonomy_view import TaxonomyView def _write_pair(tmp_path, it_lines, en_lines): it_file = tmp_path / "tags-it.txt" @@ -41,3 +42,35 @@ def test_save_taxonomy_sorted(tmp_path): save_taxonomy(model, it_f, en_f) lines = it_f.read_text().splitlines() assert lines == sorted(lines) + + +def test_detect_renames_en_change(qtbot): + old = {"linux": "linux", "vita": "life"} + new = {"linux": "linux", "vita": "living"} + it_r, en_r = TaxonomyView._detect_renames(old, new) + assert it_r == {} + assert en_r == {"life": "living"} + + +def test_detect_renames_it_change(qtbot): + old = {"linux": "linux", "vita": "life"} + new = {"linux": "linux", "living": "life"} + it_r, en_r = TaxonomyView._detect_renames(old, new) + assert it_r == {"vita": "living"} + assert en_r == {} + + +def test_detect_renames_no_change(qtbot): + old = {"linux": "linux"} + new = {"linux": "linux"} + it_r, en_r = TaxonomyView._detect_renames(old, new) + assert it_r == {} + assert en_r == {} + + +def test_detect_renames_addition_not_rename(qtbot): + old = {"linux": "linux"} + new = {"linux": "linux", "vita": "life"} + it_r, en_r = TaxonomyView._detect_renames(old, new) + assert it_r == {} + assert en_r == {} |
