From 1cf0100bf6e2f50d7562d5ed69b9fd4351c3043e Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 5 Feb 2016 19:38:22 +0100 Subject: [PATCH] * Add test for multithreading --- spacy/tests/website/test_home.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spacy/tests/website/test_home.py b/spacy/tests/website/test_home.py index 7797eb639..b54e498f8 100644 --- a/spacy/tests/website/test_home.py +++ b/spacy/tests/website/test_home.py @@ -160,3 +160,15 @@ def test_efficient_binary_serialization(doc): for byte_string in Doc.read_bytes(open('moby_dick.bin', 'rb')): doc = Doc(nlp.vocab) 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 +