Simplify test

This commit is contained in:
Ines Montani 2019-08-20 16:41:58 +02:00
parent 68ee0384fd
commit 364aaf5bc2

View File

@ -2,20 +2,15 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import pytest import pytest
from spacy.lang.en import English
from spacy.matcher import Matcher from spacy.matcher import Matcher
from spacy.tokens import Doc
@pytest.mark.xfail @pytest.mark.xfail
def test_issue3879(en_vocab): def test_issue3879(en_vocab):
nlp = English() doc = Doc(en_vocab, words=["This", "is", "a", "test", "."])
text = "This is a test."
doc = nlp(text)
assert len(doc) == 5 assert len(doc) == 5
pattern = [{"ORTH": "This", "OP": "?"}, {"OP": "?"}, {"ORTH": "test"}] pattern = [{"ORTH": "This", "OP": "?"}, {"OP": "?"}, {"ORTH": "test"}]
matcher = Matcher(nlp.vocab) matcher = Matcher(en_vocab)
matcher.add("rule", None, pattern) matcher.add("TEST", None, pattern)
matches = matcher(doc) assert len(matcher(doc)) == 2 # fails because of a FP match 'is a test'
assert len(matches) == 2 # fails because of a FP match 'is a test'