From 4533c7408d3b15b133773dd3ccef742f3d293432 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 15 Feb 2018 15:39:47 +0100 Subject: [PATCH] Update matcher tests --- spacy/tests/regression/test_issue1450.py | 6 +++--- spacy/tests/regression/test_issue1855.py | 2 +- spacy/tests/regression/test_issue1883.py | 2 +- spacy/tests/regression/test_issue1945.py | 3 +-- spacy/tests/regression/test_issue850.py | 2 +- spacy/tests/test_matcher.py | 12 +++++------- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/spacy/tests/regression/test_issue1450.py b/spacy/tests/regression/test_issue1450.py index d099763d2..1609f71f5 100644 --- a/spacy/tests/regression/test_issue1450.py +++ b/spacy/tests/regression/test_issue1450.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals import pytest -from ...matcher2 import Matcher +from ...matcher import Matcher from ...tokens import Doc from ...vocab import Vocab @@ -54,5 +54,5 @@ def test_issue1450_matcher_end_zero_plus(string, start, end): if start is None or end is None: assert matches == [] - assert matches[0][1] == start - assert matches[0][2] == end + assert matches[-1][1] == start + assert matches[-1][2] == end diff --git a/spacy/tests/regression/test_issue1855.py b/spacy/tests/regression/test_issue1855.py index e10af0d60..b12b5c251 100644 --- a/spacy/tests/regression/test_issue1855.py +++ b/spacy/tests/regression/test_issue1855.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import re -from ...matcher2 import Matcher +from ...matcher import Matcher import pytest diff --git a/spacy/tests/regression/test_issue1883.py b/spacy/tests/regression/test_issue1883.py index 1c7393d8d..3fcf905c1 100644 --- a/spacy/tests/regression/test_issue1883.py +++ b/spacy/tests/regression/test_issue1883.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import copy from ... vocab import Vocab -from ... matcher2 import Matcher +from ... matcher import Matcher from ... tokens import Doc diff --git a/spacy/tests/regression/test_issue1945.py b/spacy/tests/regression/test_issue1945.py index 59135033a..052f699fb 100644 --- a/spacy/tests/regression/test_issue1945.py +++ b/spacy/tests/regression/test_issue1945.py @@ -4,9 +4,8 @@ import pytest from ...vocab import Vocab from ...tokens import Doc -from ...matcher2 import Matcher +from ...matcher import Matcher -#@pytest.mark.xfail def test_issue1945(): text = "a a a" matcher = Matcher(Vocab()) diff --git a/spacy/tests/regression/test_issue850.py b/spacy/tests/regression/test_issue850.py index e3611c4a6..e83b4d8af 100644 --- a/spacy/tests/regression/test_issue850.py +++ b/spacy/tests/regression/test_issue850.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import pytest -from ...matcher2 import Matcher +from ...matcher import Matcher from ...vocab import Vocab from ...attrs import LOWER from ...tokens import Doc diff --git a/spacy/tests/test_matcher.py b/spacy/tests/test_matcher.py index d585a9255..521121861 100644 --- a/spacy/tests/test_matcher.py +++ b/spacy/tests/test_matcher.py @@ -1,8 +1,7 @@ # coding: utf-8 from __future__ import unicode_literals -from ..matcher2 import Matcher -from ..matcher2 import PhraseMatcher +from ..matcher import Matcher, PhraseMatcher from .util import get_doc from ..tokens import Doc @@ -254,9 +253,8 @@ def test_matcher_end_zero_plus(matcher): ) nlp = lambda string: Doc(matcher.vocab, words=string.split()) assert len(matcher(nlp(u'a'))) == 1 - assert len(matcher(nlp(u'a b'))) == 1 - assert len(matcher(nlp(u'a b'))) == 1 + assert len(matcher(nlp(u'a b'))) == 2 assert len(matcher(nlp(u'a c'))) == 1 - assert len(matcher(nlp(u'a b c'))) == 1 - assert len(matcher(nlp(u'a b b c'))) == 1 - assert len(matcher(nlp(u'a b b'))) == 1 + assert len(matcher(nlp(u'a b c'))) == 2 + assert len(matcher(nlp(u'a b b c'))) == 3 + assert len(matcher(nlp(u'a b b'))) == 3