Skip to content

Commit

Permalink
Add regression test for #3951
Browse files Browse the repository at this point in the history
  • Loading branch information
ines committed Jul 16, 2019
1 parent 7f55105 commit 62ff128
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spacy/tests/regression/test_issue3951.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 62ff128

Please sign in to comment.