mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 04:08:09 +03:00
Rewrite tests for issue #1769
This commit is contained in:
parent
76f4eeca44
commit
0e62809a43
|
@ -2,54 +2,84 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from ...lang.da.lex_attrs import like_num as da_like_num
|
from ...lang.da.lex_attrs import like_num as da_like_num
|
||||||
# from ...lang.en.lex_attrs import like_num as en_like_num
|
from ...lang.en.lex_attrs import like_num as en_like_num
|
||||||
# from ...lang.fr.lex_attrs import like_num as fr_like_num
|
from ...lang.fr.lex_attrs import like_num as fr_like_num
|
||||||
# from ...lang.id.lex_attrs import like_num as id_like_num
|
from ...lang.id.lex_attrs import like_num as id_like_num
|
||||||
# from ...lang.nl.lex_attrs import like_num as nl_like_num
|
from ...lang.nl.lex_attrs import like_num as nl_like_num
|
||||||
# from ...lang.pt.lex_attrs import like_num as pt_like_num
|
from ...lang.pt.lex_attrs import like_num as pt_like_num
|
||||||
# from ...lang.ru.lex_attrs import like_num as ru_like_num
|
from ...lang.ru.lex_attrs import like_num as ru_like_num
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('num_words', ['elleve', 'ELLEVE'])
|
@pytest.fixture
|
||||||
@pytest.mark.parametrize('ordinal_words', ['første', 'FØRSTE'])
|
def words():
|
||||||
def test_da_lex_attrs(num_words, ordinal_words):
|
return {
|
||||||
assert da_like_num(num_words) == True
|
"da": {
|
||||||
assert da_like_num(ordinal_words) == True
|
"num_words": ('elleve', 'ELLEVE'),
|
||||||
|
"ord_words": ('første', 'FØRSTE')
|
||||||
|
},
|
||||||
|
"en": {
|
||||||
|
"num_words": ('eleven', 'ELEVEN')
|
||||||
|
},
|
||||||
|
"fr": {
|
||||||
|
"num_words": ('onze', 'ONZE'),
|
||||||
|
"ord_words": ('onzième', 'ONZIÈME')
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"num_words": ('sebelas', 'SEBELAS')
|
||||||
|
},
|
||||||
|
"nl": {
|
||||||
|
"num_words": ('elf', 'ELF'),
|
||||||
|
"ord_words": ('elfde', 'ELFDE')
|
||||||
|
},
|
||||||
|
"pt": {
|
||||||
|
"num_words": ('onze', 'ONZE'),
|
||||||
|
"ord_words": ('quadragésimo', 'QUADRAGÉSIMO')
|
||||||
|
},
|
||||||
|
"ru": {
|
||||||
|
"num_words": ('одиннадцать', 'ОДИННАДЦАТЬ')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# @pytest.mark.parametrize('num_words', ['eleven', 'ELEVEN'])
|
|
||||||
# def test_en_lex_attrs(num_words):
|
def like_num(words, fn):
|
||||||
# assert en_like_num(num_words) == True
|
ok = True
|
||||||
#
|
for word in words:
|
||||||
#
|
if fn(word) is not True:
|
||||||
# @pytest.mark.parametrize('num_words', ['onze', 'ONZE'])
|
ok = False
|
||||||
# @pytest.mark.parametrize('ordinal_words', ['onzième', 'ONZIÈME'])
|
break
|
||||||
# def test_fr_lex_attrs(num_words, ordinal_words):
|
return ok
|
||||||
# assert fr_like_num(num_words) == True
|
|
||||||
# assert fr_like_num(ordinal_words) == True
|
|
||||||
#
|
def test_da_lex_attrs(words):
|
||||||
#
|
assert like_num(words["da"]["num_words"], da_like_num) == True
|
||||||
# @pytest.mark.parametrize('num_words', ['sebelas', 'SEBELAS'])
|
assert like_num(words["da"]["ord_words"], da_like_num) == True
|
||||||
# def test_id_lex_attrs(num_words):
|
|
||||||
# assert id_like_num(num_words) == True
|
|
||||||
#
|
def test_en_lex_attrs(words):
|
||||||
#
|
assert like_num(words["en"]["num_words"], en_like_num) == True
|
||||||
# @pytest.mark.parametrize('num_words', ['elf', 'ELF'])
|
|
||||||
# @pytest.mark.parametrize('ordinal_words', ['elfde', 'ELFDE'])
|
|
||||||
# def test_nl_lex_attrs(num_words, ordinal_words):
|
def test_fr_lex_attrs(words):
|
||||||
# assert nl_like_num(num_words) == True
|
assert like_num(words["fr"]["num_words"], fr_like_num) == True
|
||||||
# assert nl_like_num(ordinal_words) == True
|
assert like_num(words["fr"]["ord_words"], fr_like_num) == True
|
||||||
#
|
|
||||||
#
|
|
||||||
# @pytest.mark.parametrize('num_words', ['onze', 'ONZE'])
|
def test_id_lex_attrs(words):
|
||||||
# @pytest.mark.parametrize('ordinal_words', ['quadragésimo', 'QUADRAGÉSIMO'])
|
assert like_num(words["id"]["num_words"], id_like_num) == True
|
||||||
# def test_pt_lex_attrs(num_words, ordinal_words):
|
|
||||||
# assert pt_like_num(num_words) == True
|
|
||||||
# assert pt_like_num(ordinal_words) == True
|
def test_nl_lex_attrs(words):
|
||||||
#
|
assert like_num(words["nl"]["num_words"], nl_like_num) == True
|
||||||
#
|
assert like_num(words["nl"]["ord_words"], nl_like_num) == True
|
||||||
# @pytest.mark.parametrize('num_words', ['одиннадцать', 'ОДИННАДЦАТЬ'])
|
|
||||||
# def test_ru_lex_attrs(num_words):
|
|
||||||
# assert ru_like_num(num_words) == True
|
def test_pt_lex_attrs(words):
|
||||||
|
assert like_num(words["pt"]["num_words"], pt_like_num) == True
|
||||||
|
assert like_num(words["pt"]["ord_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