From c606b4a42c9f87caea01d8d4308924f00d3c5d10 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 19 Aug 2017 16:18:23 +0200 Subject: [PATCH] Add test for Doc.char_span --- spacy/tests/spans/test_span.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spacy/tests/spans/test_span.py b/spacy/tests/spans/test_span.py index d22fa52ae..fecfe0da8 100644 --- a/spacy/tests/spans/test_span.py +++ b/spacy/tests/spans/test_span.py @@ -89,3 +89,10 @@ def test_spans_are_hashable(en_tokenizer): span3 = tokens[0:2] assert hash(span3) == hash(span1) + +def test_spans_by_character(doc): + span1 = doc[1:-2] + span2 = doc.char_span(span1.start_char, span1.end_char, label='GPE') + assert span1.start_char == span2.start_char + assert span1.end_char == span2.end_char + assert span2.label_ == 'GPE'