From 1a735e0f1f079f79f3d5a673e3d641f3916f7ad1 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Mon, 25 Feb 2019 10:12:58 +0100 Subject: [PATCH] Add regression test for #3328 --- spacy/tests/regression/test_issue3328.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 spacy/tests/regression/test_issue3328.py diff --git a/spacy/tests/regression/test_issue3328.py b/spacy/tests/regression/test_issue3328.py new file mode 100644 index 000000000..fce25ca1c --- /dev/null +++ b/spacy/tests/regression/test_issue3328.py @@ -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"]