2019-02-14 17:31:19 +03:00
|
|
|
import pytest
|
|
|
|
|
2023-06-14 18:48:41 +03:00
|
|
|
from spacy.util import get_lang_class
|
2019-02-14 17:31:19 +03:00
|
|
|
|
|
|
|
# fmt: off
|
|
|
|
# Only include languages with no external dependencies
|
2021-07-09 16:36:35 +03:00
|
|
|
# excluded: ja, ko, th, vi, zh
|
|
|
|
LANGUAGES = ["af", "am", "ar", "az", "bg", "bn", "ca", "cs", "da", "de", "el",
|
|
|
|
"en", "es", "et", "eu", "fa", "fi", "fr", "ga", "gu", "he", "hi",
|
|
|
|
"hr", "hu", "hy", "id", "is", "it", "kn", "ky", "lb", "lt", "lv",
|
|
|
|
"mk", "ml", "mr", "nb", "ne", "nl", "pl", "pt", "ro", "ru", "sa",
|
|
|
|
"si", "sk", "sl", "sq", "sr", "sv", "ta", "te", "ti", "tl", "tn",
|
2024-09-09 12:15:40 +03:00
|
|
|
"tr", "tt", "uk", "ur", "xx", "yo", "kmr"]
|
2019-02-14 17:31:19 +03:00
|
|
|
# fmt: on
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("lang", LANGUAGES)
|
2019-02-27 18:04:30 +03:00
|
|
|
def test_lang_initialize(lang, capfd):
|
2019-02-14 17:31:19 +03:00
|
|
|
"""Test that languages can be initialized."""
|
2019-03-07 14:25:00 +03:00
|
|
|
nlp = get_lang_class(lang)()
|
2019-02-27 18:04:30 +03:00
|
|
|
# Check for stray print statements (see #3342)
|
2019-03-07 14:25:00 +03:00
|
|
|
doc = nlp("test") # noqa: F841
|
2019-02-27 18:04:30 +03:00
|
|
|
captured = capfd.readouterr()
|
|
|
|
assert not captured.out
|