mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-05 06:00:36 +03:00
Update matcher tests
This commit is contained in:
parent
1c19605426
commit
4533c7408d
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from ...matcher2 import Matcher
|
from ...matcher import Matcher
|
||||||
from ...tokens import Doc
|
from ...tokens import Doc
|
||||||
from ...vocab import Vocab
|
from ...vocab import Vocab
|
||||||
|
|
||||||
|
@ -54,5 +54,5 @@ def test_issue1450_matcher_end_zero_plus(string, start, end):
|
||||||
if start is None or end is None:
|
if start is None or end is None:
|
||||||
assert matches == []
|
assert matches == []
|
||||||
|
|
||||||
assert matches[0][1] == start
|
assert matches[-1][1] == start
|
||||||
assert matches[0][2] == end
|
assert matches[-1][2] == end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ...matcher2 import Matcher
|
from ...matcher import Matcher
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from __future__ import unicode_literals
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ... vocab import Vocab
|
from ... vocab import Vocab
|
||||||
from ... matcher2 import Matcher
|
from ... matcher import Matcher
|
||||||
from ... tokens import Doc
|
from ... tokens import Doc
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,8 @@ import pytest
|
||||||
|
|
||||||
from ...vocab import Vocab
|
from ...vocab import Vocab
|
||||||
from ...tokens import Doc
|
from ...tokens import Doc
|
||||||
from ...matcher2 import Matcher
|
from ...matcher import Matcher
|
||||||
|
|
||||||
#@pytest.mark.xfail
|
|
||||||
def test_issue1945():
|
def test_issue1945():
|
||||||
text = "a a a"
|
text = "a a a"
|
||||||
matcher = Matcher(Vocab())
|
matcher = Matcher(Vocab())
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from ...matcher2 import Matcher
|
from ...matcher import Matcher
|
||||||
from ...vocab import Vocab
|
from ...vocab import Vocab
|
||||||
from ...attrs import LOWER
|
from ...attrs import LOWER
|
||||||
from ...tokens import Doc
|
from ...tokens import Doc
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from ..matcher2 import Matcher
|
from ..matcher import Matcher, PhraseMatcher
|
||||||
from ..matcher2 import PhraseMatcher
|
|
||||||
from .util import get_doc
|
from .util import get_doc
|
||||||
from ..tokens import Doc
|
from ..tokens import Doc
|
||||||
|
|
||||||
|
@ -254,9 +253,8 @@ def test_matcher_end_zero_plus(matcher):
|
||||||
)
|
)
|
||||||
nlp = lambda string: Doc(matcher.vocab, words=string.split())
|
nlp = lambda string: Doc(matcher.vocab, words=string.split())
|
||||||
assert len(matcher(nlp(u'a'))) == 1
|
assert len(matcher(nlp(u'a'))) == 1
|
||||||
assert len(matcher(nlp(u'a b'))) == 1
|
assert len(matcher(nlp(u'a b'))) == 2
|
||||||
assert len(matcher(nlp(u'a b'))) == 1
|
|
||||||
assert len(matcher(nlp(u'a c'))) == 1
|
assert len(matcher(nlp(u'a c'))) == 1
|
||||||
assert len(matcher(nlp(u'a b c'))) == 1
|
assert len(matcher(nlp(u'a b c'))) == 2
|
||||||
assert len(matcher(nlp(u'a b b c'))) == 1
|
assert len(matcher(nlp(u'a b b c'))) == 3
|
||||||
assert len(matcher(nlp(u'a b b'))) == 1
|
assert len(matcher(nlp(u'a b b'))) == 3
|
||||||
|
|
Loading…
Reference in New Issue
Block a user