From 126d1db1234295a901d57553e275a6d9adf593ab Mon Sep 17 00:00:00 2001 From: Madeesh Kannan Date: Mon, 13 Jun 2022 10:56:45 +0200 Subject: [PATCH] Add failing test: `test_matcher_extension_in_set_predicate` (#10948) --- spacy/tests/matcher/test_matcher_api.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spacy/tests/matcher/test_matcher_api.py b/spacy/tests/matcher/test_matcher_api.py index a27baf130..e8c3d53e8 100644 --- a/spacy/tests/matcher/test_matcher_api.py +++ b/spacy/tests/matcher/test_matcher_api.py @@ -476,6 +476,17 @@ def test_matcher_extension_set_membership(en_vocab): assert len(matches) == 0 +@pytest.mark.xfail(reason="IN predicate must handle sequence values in extensions") +def test_matcher_extension_in_set_predicate(en_vocab): + matcher = Matcher(en_vocab) + Token.set_extension("ext", default=[]) + pattern = [{"_": {"ext": {"IN": ["A", "C"]}}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0]._.ext = ["A", "B"] + assert len(matcher(doc)) == 1 + + def test_matcher_basic_check(en_vocab): matcher = Matcher(en_vocab) # Potential mistake: pass in pattern instead of list of patterns