From 5887383fc04b0d332ac7ab0051a5c3650bf82dde Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 7 Apr 2017 15:47:27 +0200 Subject: [PATCH] Add test for Issue #913: Hang from bad regex --- spacy/tests/regression/test_issue913.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 spacy/tests/regression/test_issue913.py diff --git a/spacy/tests/regression/test_issue913.py b/spacy/tests/regression/test_issue913.py new file mode 100644 index 000000000..3f7cb8818 --- /dev/null +++ b/spacy/tests/regression/test_issue913.py @@ -0,0 +1,16 @@ +import pytest +from ... import load as load_spacy + + +def test_issue913(en_tokenizer): + '''Test that spaCy doesn't hang on many periods.''' + string = '0' + for i in range(1, 100): + string += '.%d' % i + doc = en_tokenizer(string) + +# Don't want tests to fail if they haven't installed pytest-timeout plugin +try: + test_issue913 = pytest.mark.timeout(5)(test_issue913) +except NameError: + pass