mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 01:16:28 +03:00
Simplify test
This commit is contained in:
parent
68ee0384fd
commit
364aaf5bc2
|
@ -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'
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user