Tidy up fixtures

This commit is contained in:
Ines Montani 2019-09-27 17:57:59 +02:00
parent b21b2e27e5
commit acd5bcb0b3
2 changed files with 6 additions and 7 deletions

View File

@ -185,6 +185,12 @@ def ru_tokenizer():
return get_lang_class("ru").Defaults.create_tokenizer() return get_lang_class("ru").Defaults.create_tokenizer()
@pytest.fixture
def ru_lemmatizer():
pytest.importorskip("pymorphy2")
return get_lang_class("ru").Defaults.create_lemmatizer()
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def sr_tokenizer(): def sr_tokenizer():
return get_lang_class("sr").Defaults.create_tokenizer() return get_lang_class("sr").Defaults.create_tokenizer()

View File

@ -2,17 +2,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import pytest import pytest
from spacy.lang.ru import Russian
from ...util import get_doc from ...util import get_doc
@pytest.fixture
def ru_lemmatizer():
pytest.importorskip("pymorphy2")
return Russian.Defaults.create_lemmatizer()
def test_ru_doc_lemmatization(ru_tokenizer): def test_ru_doc_lemmatization(ru_tokenizer):
words = ["мама", "мыла", "раму"] words = ["мама", "мыла", "раму"]
tags = [ tags = [