Fix tests

This commit is contained in:
Matthew Honnibal 2017-03-16 18:53:47 -05:00
parent adb0b7e43b
commit db51abf685
2 changed files with 2 additions and 14 deletions

View File

@ -16,7 +16,6 @@ from ..tokens import Doc
from ..strings import StringStore from ..strings import StringStore
from ..lemmatizer import Lemmatizer from ..lemmatizer import Lemmatizer
from ..attrs import ORTH, TAG, HEAD, DEP from ..attrs import ORTH, TAG, HEAD, DEP
from ..util import match_best_version, get_data_path
from io import StringIO, BytesIO from io import StringIO, BytesIO
from pathlib import Path from pathlib import Path
@ -91,10 +90,7 @@ def en_entityrecognizer():
@pytest.fixture @pytest.fixture
def lemmatizer(path): def lemmatizer(path):
if path is not None: return English.Defaults.ceate_lemmatizer()
return Lemmatizer.load(path)
else:
return None
@pytest.fixture @pytest.fixture
@ -106,14 +102,6 @@ def text_file_b():
return BytesIO() return BytesIO()
@pytest.fixture
def path():
if 'SPACY_DATA' in os.environ:
return Path(os.environ['SPACY_DATA'])
else:
return match_best_version('en', None, get_data_path())
# only used for tests that require loading the models # only used for tests that require loading the models
# in all other cases, use specific instances # in all other cases, use specific instances
@pytest.fixture(scope="session") @pytest.fixture(scope="session")

View File

@ -6,5 +6,5 @@ import pytest
# Note: "chromosomes" worked previous the bug fix # Note: "chromosomes" worked previous the bug fix
@pytest.mark.parametrize('word,lemmas', [("chromosomes", ["chromosome"]), ("endosomes", ["endosome"]), ("colocalizes", ["colocalize", "colocaliz"])]) @pytest.mark.parametrize('word,lemmas', [("chromosomes", ["chromosome"]), ("endosomes", ["endosome"]), ("colocalizes", ["colocalize", "colocaliz"])])
def test_issue781(path, lemmatizer, word, lemmas): def test_issue781(lemmatizer, word, lemmas):
assert lemmatizer(word, 'noun', morphology={'number': 'plur'}) == set(lemmas) assert lemmatizer(word, 'noun', morphology={'number': 'plur'}) == set(lemmas)