* Add test for multithreading

This commit is contained in:
Matthew Honnibal 2016-02-05 19:38:22 +01:00
parent b04c9aad71
commit 1cf0100bf6
1 changed files with 12 additions and 0 deletions

View File

@ -160,3 +160,15 @@ def test_efficient_binary_serialization(doc):
for byte_string in Doc.read_bytes(open('moby_dick.bin', 'rb')): for byte_string in Doc.read_bytes(open('moby_dick.bin', 'rb')):
doc = Doc(nlp.vocab) doc = Doc(nlp.vocab)
doc.from_bytes(byte_string) doc.from_bytes(byte_string)
@pytest.mark.models
def test_multithreading(nlp):
texts = [
u'One document.',
u'A second document.',
u'Another document (you should use a generator!).'
]
for doc in nlp.pipe(texts, batch_size=1000, n_threads=4):
assert doc.is_parsed