2019-02-14 17:31:19 +03:00
|
|
|
import pytest
|
|
|
|
from spacy.util import get_lang_class
|
|
|
|
|
|
|
|
|
|
|
|
# fmt: off
|
|
|
|
# Only include languages with no external dependencies
|
|
|
|
# excluded: ja, ru, th, uk, vi, zh
|
|
|
|
LANGUAGES = ["af", "ar", "bg", "bn", "ca", "cs", "da", "de", "el", "en", "es",
|
|
|
|
"et", "fa", "fi", "fr", "ga", "he", "hi", "hr", "hu", "id", "is",
|
2019-08-21 20:57:37 +03:00
|
|
|
"it", "kn", "lt", "lv", "nb", "nl", "pl", "pt", "ro", "si", "sk",
|
2019-12-21 16:11:50 +03:00
|
|
|
"sl", "sq", "sr", "sv", "ta", "te", "tl", "tr", "tt", "ur", 'yo']
|
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
|