mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 18:26:30 +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 ...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.fr.lex_attrs import like_num as fr_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.pt.lex_attrs import like_num as pt_like_num
|
||||
# from ...lang.ru.lex_attrs import like_num as ru_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.id.lex_attrs import like_num as id_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.ru.lex_attrs import like_num as ru_like_num
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize('num_words', ['elleve', 'ELLEVE'])
|
||||
@pytest.mark.parametrize('ordinal_words', ['første', 'FØRSTE'])
|
||||
def test_da_lex_attrs(num_words, ordinal_words):
|
||||
assert da_like_num(num_words) == True
|
||||
assert da_like_num(ordinal_words) == True
|
||||
@pytest.fixture
|
||||
def words():
|
||||
return {
|
||||
"da": {
|
||||
"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):
|
||||
# assert en_like_num(num_words) == True
|
||||
#
|
||||
#
|
||||
# @pytest.mark.parametrize('num_words', ['onze', 'ONZE'])
|
||||
# @pytest.mark.parametrize('ordinal_words', ['onzième', 'ONZIÈME'])
|
||||
# def test_fr_lex_attrs(num_words, ordinal_words):
|
||||
# assert fr_like_num(num_words) == True
|
||||
# assert fr_like_num(ordinal_words) == True
|
||||
#
|
||||
#
|
||||
# @pytest.mark.parametrize('num_words', ['sebelas', 'SEBELAS'])
|
||||
# def test_id_lex_attrs(num_words):
|
||||
# assert id_like_num(num_words) == True
|
||||
#
|
||||
#
|
||||
# @pytest.mark.parametrize('num_words', ['elf', 'ELF'])
|
||||
# @pytest.mark.parametrize('ordinal_words', ['elfde', 'ELFDE'])
|
||||
# def test_nl_lex_attrs(num_words, ordinal_words):
|
||||
# assert nl_like_num(num_words) == True
|
||||
# assert nl_like_num(ordinal_words) == True
|
||||
#
|
||||
#
|
||||
# @pytest.mark.parametrize('num_words', ['onze', 'ONZE'])
|
||||
# @pytest.mark.parametrize('ordinal_words', ['quadragésimo', 'QUADRAGÉSIMO'])
|
||||
# def test_pt_lex_attrs(num_words, ordinal_words):
|
||||
# assert pt_like_num(num_words) == True
|
||||
# assert pt_like_num(ordinal_words) == True
|
||||
#
|
||||
#
|
||||
# @pytest.mark.parametrize('num_words', ['одиннадцать', 'ОДИННАДЦАТЬ'])
|
||||
# def test_ru_lex_attrs(num_words):
|
||||
# assert ru_like_num(num_words) == True
|
||||
|
||||
def like_num(words, fn):
|
||||
ok = True
|
||||
for word in words:
|
||||
if fn(word) is not True:
|
||||
ok = False
|
||||
break
|
||||
return ok
|
||||
|
||||
|
||||
def test_da_lex_attrs(words):
|
||||
assert like_num(words["da"]["num_words"], da_like_num) == True
|
||||
assert like_num(words["da"]["ord_words"], da_like_num) == True
|
||||
|
||||
|
||||
def test_en_lex_attrs(words):
|
||||
assert like_num(words["en"]["num_words"], en_like_num) == True
|
||||
|
||||
|
||||
def test_fr_lex_attrs(words):
|
||||
assert like_num(words["fr"]["num_words"], fr_like_num) == True
|
||||
assert like_num(words["fr"]["ord_words"], fr_like_num) == True
|
||||
|
||||
|
||||
def test_id_lex_attrs(words):
|
||||
assert like_num(words["id"]["num_words"], id_like_num) == 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
|
||||
|
||||
|
||||
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