mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
Fix tests
This commit is contained in:
parent
adb0b7e43b
commit
db51abf685
|
@ -16,7 +16,6 @@ from ..tokens import Doc
|
|||
from ..strings import StringStore
|
||||
from ..lemmatizer import Lemmatizer
|
||||
from ..attrs import ORTH, TAG, HEAD, DEP
|
||||
from ..util import match_best_version, get_data_path
|
||||
|
||||
from io import StringIO, BytesIO
|
||||
from pathlib import Path
|
||||
|
@ -91,10 +90,7 @@ def en_entityrecognizer():
|
|||
|
||||
@pytest.fixture
|
||||
def lemmatizer(path):
|
||||
if path is not None:
|
||||
return Lemmatizer.load(path)
|
||||
else:
|
||||
return None
|
||||
return English.Defaults.ceate_lemmatizer()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -106,14 +102,6 @@ def text_file_b():
|
|||
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
|
||||
# in all other cases, use specific instances
|
||||
@pytest.fixture(scope="session")
|
||||
|
|
|
@ -6,5 +6,5 @@ import pytest
|
|||
|
||||
# Note: "chromosomes" worked previous the bug fix
|
||||
@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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user