spaCy/spacy/tests/regression/test_issue5838.py
Sofie Van Landeghem 071c09ff35
add coding (#5942)
2020-08-20 11:08:38 +02:00

26 lines
523 B
Python

# coding: utf8
from __future__ import unicode_literals
from spacy.lang.en import English
from spacy.tokens import Span
from spacy import displacy
SAMPLE_TEXT = '''First line
Second line, with ent
Third line
Fourth line
'''
def test_issue5838():
# Displacy's EntityRenderer break line
# not working after last entity
nlp = English()
doc = nlp(SAMPLE_TEXT)
doc.ents = [Span(doc, 7, 8, label='test')]
html = displacy.render(doc, style='ent')
found = html.count('</br>')
assert found == 4