diff --git a/spacy/tests/regression/test_issue1769.py b/spacy/tests/regression/test_issue1769.py index 5ce228189..63ec83908 100644 --- a/spacy/tests/regression/test_issue1769.py +++ b/spacy/tests/regression/test_issue1769.py @@ -1,55 +1,61 @@ # coding: utf-8 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 ...util import get_lang_class +from ...attrs import 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.mark.parametrize('word', ['eleven']) +def test_en_lex_attrs(word): + lang = get_lang_class('en') + like_num = lang.Defaults.lex_attr_getters[LIKE_NUM] + assert like_num(word) == like_num(word.upper()) -# @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 +@pytest.mark.slow +@pytest.mark.parametrize('word', ['elleve', 'første']) +def test_da_lex_attrs(word): + lang = get_lang_class('da') + like_num = lang.Defaults.lex_attr_getters[LIKE_NUM] + assert like_num(word) == like_num(word.upper()) + + +@pytest.mark.slow +@pytest.mark.parametrize('word', ['onze', 'onzième']) +def test_fr_lex_attrs(word): + lang = get_lang_class('fr') + like_num = lang.Defaults.lex_attr_getters[LIKE_NUM] + assert like_num(word) == like_num(word.upper()) + + +@pytest.mark.slow +@pytest.mark.parametrize('word', ['sebelas']) +def test_id_lex_attrs(word): + lang = get_lang_class('id') + like_num = lang.Defaults.lex_attr_getters[LIKE_NUM] + assert like_num(word) == like_num(word.upper()) + + +@pytest.mark.slow +@pytest.mark.parametrize('word', ['elf', 'elfde']) +def test_nl_lex_attrs(word): + lang = get_lang_class('nl') + like_num = lang.Defaults.lex_attr_getters[LIKE_NUM] + assert like_num(word) == like_num(word.upper()) + + +@pytest.mark.slow +@pytest.mark.parametrize('word', ['onze', 'quadragésimo']) +def test_pt_lex_attrs(word): + lang = get_lang_class('pt') + like_num = lang.Defaults.lex_attr_getters[LIKE_NUM] + assert like_num(word) == like_num(word.upper()) + + +@pytest.mark.slow +@pytest.mark.parametrize('word', ['одиннадцать']) +def test_ru_lex_attrs(word): + lang = get_lang_class('ru') + like_num = lang.Defaults.lex_attr_getters[LIKE_NUM] + assert like_num(word) == like_num(word.upper())