From 874d914a440553f8e4e3964b5677647ca9b2d967 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Wed, 10 Jul 2019 12:13:23 +0200 Subject: [PATCH] Tidy up test --- spacy/tests/regression/test_issue3526.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spacy/tests/regression/test_issue3526.py b/spacy/tests/regression/test_issue3526.py index 3949c4b1c..62c9d5532 100644 --- a/spacy/tests/regression/test_issue3526.py +++ b/spacy/tests/regression/test_issue3526.py @@ -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