mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Add test for #1883: Unpickling Matcher
This commit is contained in:
parent
2ad050e668
commit
edb71a280e
18
spacy/tests/regression/test_issue1883.py
Normal file
18
spacy/tests/regression/test_issue1883.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
'''Check Matcher can be unpickled correctly.'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import copy
|
||||
|
||||
from ... vocab import Vocab
|
||||
from ... matcher import Matcher
|
||||
from ... tokens import Doc
|
||||
|
||||
|
||||
def test_issue1883():
|
||||
m = Matcher(Vocab())
|
||||
m.add('pat1', None, [{'orth': 'hello'}])
|
||||
doc = Doc(m.vocab, words=['hello'])
|
||||
assert len(m(doc)) == 1
|
||||
m2 = copy.deepcopy(m)
|
||||
doc2 = Doc(m2.vocab, words=['hello'])
|
||||
assert len(m2(doc2)) == 1
|
Loading…
Reference in New Issue
Block a user