From 51ba3ef0a8a82c17b7cd85b6ba7fdbc9638efde9 Mon Sep 17 00:00:00 2001 From: ines Date: Mon, 13 Mar 2017 11:44:44 +0100 Subject: [PATCH] Add regression test for #886 --- spacy/tests/regression/test_issue886.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 spacy/tests/regression/test_issue886.py diff --git a/spacy/tests/regression/test_issue886.py b/spacy/tests/regression/test_issue886.py new file mode 100644 index 000000000..a3e4a3cd4 --- /dev/null +++ b/spacy/tests/regression/test_issue886.py @@ -0,0 +1,13 @@ +# coding: utf8 +from __future__ import unicode_literals + +import pytest + + +@pytest.mark.parametrize('text', ["Datum:2014-06-02\nDokument:76467"]) +def test_issue886(en_tokenizer, text): + """Test that no extra space is added in doc.text method.""" + doc = en_tokenizer(text) + for token in doc: + assert len(token.text) == len(token.text_with_ws) + assert text[token.idx] == token.text[0]