Files
fotoplaner/venv/lib/python3.12/site-packages/langcodes/tests/test_wikt_languages.py
T
anders 16c54c6653 Tilføjet venv med docling og afhængigheder
Testfiler opdelt i PNG og previews
2026-10-27 12:20:23 +01:00

25 lines
790 B
Python

"""
Here, we test that we can associate a language code with each language name
that is commonly used on Wiktionary, that all the language codes are
different, and that each language name matches only one code.
"""
import pytest
import langcodes
from langcodes.language_lists import WIKT_LANGUAGE_NAMES
LANGUAGES = ['en', 'de']
@pytest.mark.parametrize("target_lang", LANGUAGES)
def test_check_wiktionary_language(target_lang):
seen_codes = {}
for lang_name in WIKT_LANGUAGE_NAMES[target_lang]:
if lang_name.startswith('Proto-'):
continue
code = str(langcodes.find(lang_name))
assert code not in seen_codes, "%r and %r have the same code" % (
seen_codes[code],
lang_name,
)
seen_codes[code] = lang_name