mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +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 ..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")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user