mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 17:24:41 +03:00
Rewrite tests for issue #1769
This commit is contained in:
parent
5b541cb5ec
commit
855531537e
|
@ -12,65 +12,36 @@ from ...lang.ru.lex_attrs import like_num as ru_like_num
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.mark.parametrize('word', ['elleve', 'første'])
|
||||||
def words():
|
def test_da_lex_attrs(word):
|
||||||
return {
|
assert da_like_num(word) == da_like_num(word.upper())
|
||||||
"da": {
|
|
||||||
"num_words": ('elleve', 'ELLEVE')
|
|
||||||
},
|
|
||||||
"en": {
|
|
||||||
"num_words": ('eleven', 'ELEVEN')
|
|
||||||
},
|
|
||||||
"fr": {
|
|
||||||
"num_words": ('onze', 'ONZE')
|
|
||||||
},
|
|
||||||
"id": {
|
|
||||||
"num_words": ('sebelas', 'SEBELAS')
|
|
||||||
},
|
|
||||||
"nl": {
|
|
||||||
"num_words": ('elf', 'ELF')
|
|
||||||
},
|
|
||||||
"pt": {
|
|
||||||
"num_words": ('onze', 'ONZE')
|
|
||||||
},
|
|
||||||
"ru": {
|
|
||||||
"num_words": ('одиннадцать', 'ОДИННАДЦАТЬ')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def like_num(words, fn):
|
@pytest.mark.parametrize('word', ['eleven'])
|
||||||
ok = True
|
def test_en_lex_attrs(word):
|
||||||
for word in words:
|
assert en_like_num(word) == en_like_num(word.upper())
|
||||||
if fn(word) is not True:
|
|
||||||
ok = False
|
|
||||||
break
|
|
||||||
return ok
|
|
||||||
|
|
||||||
|
|
||||||
def test_da_lex_attrs(words):
|
@pytest.mark.parametrize('word', ['onze', 'onzième'])
|
||||||
assert like_num(words["da"]["num_words"], da_like_num) == True
|
def test_fr_lex_attrs(word):
|
||||||
|
assert fr_like_num(word) == fr_like_num(word.upper())
|
||||||
|
|
||||||
|
|
||||||
def test_en_lex_attrs(words):
|
@pytest.mark.parametrize('word', ['sebelas'])
|
||||||
assert like_num(words["en"]["num_words"], en_like_num) == True
|
def test_id_lex_attrs(word):
|
||||||
|
assert id_like_num(word) == id_like_num(word.upper())
|
||||||
|
|
||||||
|
|
||||||
def test_fr_lex_attrs(words):
|
@pytest.mark.parametrize('word', ['elf', 'elfde'])
|
||||||
assert like_num(words["fr"]["num_words"], fr_like_num) == True
|
def test_nl_lex_attrs(word):
|
||||||
|
assert nl_like_num(word) == nl_like_num(word.upper())
|
||||||
|
|
||||||
|
|
||||||
def test_id_lex_attrs(words):
|
@pytest.mark.parametrize('word', ['onze', 'quadragésimo'])
|
||||||
assert like_num(words["id"]["num_words"], id_like_num) == True
|
def test_pt_lex_attrs(word):
|
||||||
|
assert pt_like_num(word) == pt_like_num(word.upper())
|
||||||
|
|
||||||
|
|
||||||
def test_nl_lex_attrs(words):
|
@pytest.mark.parametrize('word', ['одиннадцать'])
|
||||||
assert like_num(words["nl"]["num_words"], nl_like_num) == True
|
def test_ru_lex_attrs(word):
|
||||||
|
assert ru_like_num(word) == ru_like_num(word.upper())
|
||||||
|
|
||||||
def test_pt_lex_attrs(words):
|
|
||||||
assert like_num(words["pt"]["num_words"], pt_like_num) == True
|
|
||||||
|
|
||||||
|
|
||||||
def test_ru_lex_attrs(words):
|
|
||||||
assert like_num(words["ru"]["num_words"], ru_like_num) == True
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user