@@ -0,0 +1,957 @@
+# coding: utf8%0Afrom __future__ import unicode_literals%0A%0Aimport pytest%0Afrom spacy.matcher import Matcher%0Afrom spacy.tokens import Doc%0A%0A%0A@pytest.mark.xfail%0Adef test_issue4120(en_vocab):%0A    %22%22%22Test that matches without a final %7BOP: ?%7D token are returned.%22%22%22%0A    matcher = Matcher(en_vocab)%0A    matcher.add(%22TEST%22, None, %5B%7B%22ORTH%22: %22a%22%7D, %7B%22OP%22: %22?%22%7D%5D)%0A    doc1 = Doc(en_vocab, words=%5B%22a%22%5D)%0A    assert len(matcher(doc1)) == 1  # works%0A    doc2 = Doc(en_vocab, words=%5B%22a%22, %22b%22, %22c%22%5D)%0A    assert len(matcher(doc2)) == 2  # doesn't work%0A%0A    matcher = Matcher(en_vocab)%0A    matcher.add(%22TEST%22, None, %5B%7B%22ORTH%22: %22a%22%7D, %7B%22OP%22: %22?%22%7D, %7B%22ORTH%22: %22b%22%7D%5D)%0A    doc3 = Doc(en_vocab, words=%5B%22a%22, %22b%22, %22b%22, %22c%22%5D)%0A    assert len(matcher(doc3)) == 2  # works%0A%0A    matcher = Matcher(en_vocab)%0A    matcher.add(%22TEST%22, None, %5B%7B%22ORTH%22: %22a%22%7D, %7B%22OP%22: %22?%22%7D, %7B%22ORTH%22: %22b%22, %22OP%22: %22?%22%7D%5D)%0A    doc4 = Doc(en_vocab, words=%5B%22a%22, %22b%22, %22b%22, %22c%22%5D)%0A    assert len(matcher(doc4)) == 3  # doesn't work%0A

Add regression test for #4120