mirror of https://github.com/explosion/spaCy.git
* Add test for multithreading
This commit is contained in:
parent
b04c9aad71
commit
1cf0100bf6
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue