Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/test_gallery_parity.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
"""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"),
("Київ", "Kyiv"),
]


@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 (
Expand Down
9 changes: 9 additions & 0 deletions tests/test_interscript.py
Original file line number Diff line number Diff line change
@@ -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ß!')
Loading