Tidy up test
@@ -7,6 +7,7 @@ from spacy.language import Language
from spacy.pipeline import EntityRuler
from spacy import load
import srsly
+
from ..util import make_tempdir
@@ -79,8 +80,10 @@ def test_entity_ruler_in_pipeline_from_issue(patterns, en_vocab):
nlp.add_pipe(ruler)
with make_tempdir() as tmpdir:
nlp.to_disk(tmpdir)
- assert nlp.pipeline[-1][-1].patterns == [{"label": "ORG", "pattern": "Apple"}]
- assert nlp.pipeline[-1][-1].overwrite is True
+ ruler = nlp.get_pipe("entity_ruler")
+ assert ruler.patterns == [{"label": "ORG", "pattern": "Apple"}]
+ assert ruler.overwrite is True
nlp2 = load(tmpdir)
- assert nlp2.pipeline[-1][-1].patterns == [{"label": "ORG", "pattern": "Apple"}]
- assert nlp2.pipeline[-1][-1].overwrite is True
+ new_ruler = nlp2.get_pipe("entity_ruler")
+ assert new_ruler.patterns == [{"label": "ORG", "pattern": "Apple"}]
+ assert new_ruler.overwrite is True
