mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-27 17:54:39 +03:00
Tidy up test
This commit is contained in:
parent
ea2050079b
commit
874d914a44
|
@ -7,6 +7,7 @@ from spacy.language import Language
|
||||||
from spacy.pipeline import EntityRuler
|
from spacy.pipeline import EntityRuler
|
||||||
from spacy import load
|
from spacy import load
|
||||||
import srsly
|
import srsly
|
||||||
|
|
||||||
from ..util import make_tempdir
|
from ..util import make_tempdir
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,8 +80,10 @@ def test_entity_ruler_in_pipeline_from_issue(patterns, en_vocab):
|
||||||
nlp.add_pipe(ruler)
|
nlp.add_pipe(ruler)
|
||||||
with make_tempdir() as tmpdir:
|
with make_tempdir() as tmpdir:
|
||||||
nlp.to_disk(tmpdir)
|
nlp.to_disk(tmpdir)
|
||||||
assert nlp.pipeline[-1][-1].patterns == [{"label": "ORG", "pattern": "Apple"}]
|
ruler = nlp.get_pipe("entity_ruler")
|
||||||
assert nlp.pipeline[-1][-1].overwrite is True
|
assert ruler.patterns == [{"label": "ORG", "pattern": "Apple"}]
|
||||||
|
assert ruler.overwrite is True
|
||||||
nlp2 = load(tmpdir)
|
nlp2 = load(tmpdir)
|
||||||
assert nlp2.pipeline[-1][-1].patterns == [{"label": "ORG", "pattern": "Apple"}]
|
new_ruler = nlp2.get_pipe("entity_ruler")
|
||||||
assert nlp2.pipeline[-1][-1].overwrite is True
|
assert new_ruler.patterns == [{"label": "ORG", "pattern": "Apple"}]
|
||||||
|
assert new_ruler.overwrite is True
|
||||||
|
|
Loading…
Reference in New Issue
Block a user