Skip to content

Commit

Permalink
Add regression test for explosion#3328
Browse files Browse the repository at this point in the history
  • Loading branch information
ines committed Feb 25, 2019
1 parent 1b62381 commit 1a735e0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spacy/tests/regression/test_issue3328.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# coding: utf-8
from __future__ import unicode_literals

import pytest
from spacy.matcher import Matcher
from spacy.tokens import Doc


@pytest.mark.xfail
def test_issue3328(en_vocab):
doc = Doc(en_vocab, words=["Hello", ",", "how", "are", "you", "doing", "?"])
matcher = Matcher(en_vocab)
patterns = [
[{"LOWER": {"IN": ["hello", "how"]}}],
[{"LOWER": {"IN": ["you", "doing"]}}],
]
matcher.add("TEST", None, *patterns)
matches = matcher(doc)
assert len(matches) == 4
matched_texts = [doc[start:end].text for _, start, end in matches]
assert matched_texts == ["Hello", "how", "you", "doing"]

0 comments on commit 1a735e0

Please sign in to comment.