diff --git a/tests/test_gallery_parity.py b/tests/test_gallery_parity.py index fcdf8a0..4f3e7dc 100644 --- a/tests/test_gallery_parity.py +++ b/tests/test_gallery_parity.py @@ -1,10 +1,15 @@ """Gallery parity: the same conversion table the TypeScript example gallery (interscript-ts/examples/) asserts. Same bytes from every runtime - demonstrated, not claimed. Adding a case = one line.""" +import os +from pathlib import Path + import pytest import interscript +MAPS = Path(os.environ.get("INTERSCRIPT_MAPS_PATH", Path(__file__).parent.parent.parent / "maps" / "maps")) + GALLERY = [ ("Антон Олегович", "Anton Olehovych"), ("Соломія", "Solomiia"), @@ -12,6 +17,7 @@ ] +@pytest.mark.skipif(not MAPS.is_dir(), reason="interscript maps repo not present") @pytest.mark.parametrize("input_text,expected", GALLERY) def test_gallery_parity(input_text, expected): assert ( diff --git a/tests/test_interscript.py b/tests/test_interscript.py index 4225583..db1ba62 100644 --- a/tests/test_interscript.py +++ b/tests/test_interscript.py @@ -1,12 +1,21 @@ +import os +from pathlib import Path + +import pytest + import interscript +MAPS = Path(os.environ.get("INTERSCRIPT_MAPS_PATH", Path(__file__).parent.parent.parent / "maps" / "maps")) + def assert_transliteration(map, input, output): interscript.load_map(map) result = interscript.transliterate(map, input) assert result == output +@pytest.mark.skipif(not MAPS.is_dir(), reason="interscript maps repo not present") def test_can_transliterate(): assert_transliteration('bgnpcgn-ukr-Cyrl-Latn-2019', 'Антон', 'Anton') +@pytest.mark.skipif(not MAPS.is_dir(), reason="interscript maps repo not present") def test_can_transliterate_maps_requiring_libraries(): assert_transliteration('bgnpcgn-deu-Latn-Latn-2000', 'Tschüß!', 'Tschueß!')