Skip to content

Commit cc3646b

Browse files
committed
Add xfailing test for peculiar spans failure [ci skip]
1 parent e50dc2c commit cc3646b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spacy/tests/doc/test_doc_api.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,16 @@ def test_doc_init_iob():
606606
ents = [0, "B-", "O", "I-PERSON", "I-GPE"]
607607
with pytest.raises(ValueError):
608608
doc = Doc(Vocab(), words=words, ents=ents)
609+
610+
611+
@pytest.mark.xfail
612+
def test_doc_set_ents_spans(en_tokenizer):
613+
doc = en_tokenizer("Some text about Colombia and the Czech Republic")
614+
spans = [Span(doc, 3, 4, label="GPE"), Span(doc, 6, 8, label="GPE")]
615+
with doc.retokenize() as retokenizer:
616+
for span in spans:
617+
retokenizer.merge(span)
618+
# If this line is uncommented, it works:
619+
# print(spans)
620+
doc.ents = list(doc.ents) + spans
621+
print([ent.text for ent in doc.ents])

0 commit comments

Comments
 (0)