Add regression test for issue 2179

This commit is contained in:
Matthew Honnibal 2018-07-20 17:15:44 +02:00
parent 9db77fd914
commit 899f1cf442
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
'''Test that spurious 'extra_labels' aren't created when initializing NER.'''
import pytest
from ... import blank
@pytest.mark.xfail
def test_issue2179():
nlp = blank('it')
ner = nlp.create_pipe('ner')
ner.add_label('CITIZENSHIP')
nlp.add_pipe(ner)
nlp.begin_training()
nlp2 = blank('it')
nlp2.add_pipe(nlp2.create_pipe('ner'))
nlp2.from_bytes(nlp.to_bytes())
assert 'extra_labels' not in nlp2.get_pipe('ner').cfg
assert nlp2.get_pipe('ner').labels == ['CITIZENSHIP']