mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-05 21:00:19 +03:00
catch warnings instead of ignoring
This commit is contained in:
parent
0ace0fba49
commit
8b4415f29b
|
@ -543,7 +543,6 @@ def test_spacy_blank():
|
|||
assert nlp.config["training"]["dropout"] == 0.2
|
||||
assert nlp.meta["name"] == "my_custom_model"
|
||||
|
||||
@pytest.mark.filterwarnings("ignore:\\[W124")
|
||||
@pytest.mark.parametrize(
|
||||
"lang,target",
|
||||
[
|
||||
|
@ -567,9 +566,12 @@ def test_language_matching(lang, target):
|
|||
Test that we can look up languages by equivalent or nearly-equivalent
|
||||
language codes.
|
||||
"""
|
||||
if target is None:
|
||||
assert find_matching_language(lang) == target
|
||||
else:
|
||||
with pytest.warns(UserWarning):
|
||||
assert find_matching_language(lang) == target
|
||||
|
||||
@pytest.mark.filterwarnings("ignore:\\[W124")
|
||||
@pytest.mark.parametrize(
|
||||
"lang,target",
|
||||
[
|
||||
|
@ -580,7 +582,6 @@ def test_language_matching(lang, target):
|
|||
("mo", "ro"),
|
||||
("is", "isl"),
|
||||
("xx", "mul"),
|
||||
("mul", "mul"),
|
||||
("no", "nb"),
|
||||
("pt-BR", "pt"),
|
||||
("zh-Hans", "zh"),
|
||||
|
@ -591,6 +592,11 @@ def test_blank_languages(lang, target):
|
|||
Test that we can get spacy.blank in various languages, including codes
|
||||
that are defined to be equivalent or that match by CLDR language matching.
|
||||
"""
|
||||
if lang == "en":
|
||||
nlp = spacy.blank(lang)
|
||||
assert nlp.lang == target
|
||||
else:
|
||||
with pytest.warns(UserWarning):
|
||||
nlp = spacy.blank(lang)
|
||||
assert nlp.lang == target
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user