mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
Add regression test for #3951
This commit is contained in:
parent
7f551050b1
commit
62ff128888
22
spacy/tests/regression/test_issue3951.py
Normal file
22
spacy/tests/regression/test_issue3951.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# coding: utf8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from spacy.matcher import Matcher
|
||||||
|
from spacy.tokens import Doc
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.xfail
|
||||||
|
def test_issue3951(en_vocab):
|
||||||
|
"""Test that combinations of optional rules are matched correctly."""
|
||||||
|
matcher = Matcher(en_vocab)
|
||||||
|
pattern = [
|
||||||
|
{"LOWER": "hello"},
|
||||||
|
{"LOWER": "this", "OP": "?"},
|
||||||
|
{"OP": "?"},
|
||||||
|
{"LOWER": "world"},
|
||||||
|
]
|
||||||
|
matcher.add("TEST", None, pattern)
|
||||||
|
doc = Doc(en_vocab, words=["Hello", "my", "new", "world"])
|
||||||
|
matches = matcher(doc)
|
||||||
|
assert len(matches) == 0
|
Loading…
Reference in New Issue
Block a user