mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-11 17:56:30 +03:00
failing unit test for issue #3869
This commit is contained in:
parent
a388888074
commit
a89fecce97
29
spacy/tests/regression/test_issue3869.py
Normal file
29
spacy/tests/regression/test_issue3869.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
# coding: utf8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
|
||||
from spacy.attrs import IS_ALPHA
|
||||
from spacy.lang.en import English
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"sentence",
|
||||
[
|
||||
'The story was to the effect that a young American student recently called on Professor Christlieb with a letter of introduction.',
|
||||
'The next month Barry Siddall joined Stoke City on a free transfer, after Chris Pearce had established himself as the Vale\'s #1.'
|
||||
],
|
||||
)
|
||||
def test_issue3869(sentence):
|
||||
"""Test that the Doc's count_by function works consistently"""
|
||||
nlp = English()
|
||||
|
||||
doc = nlp(sentence)
|
||||
|
||||
count = 0
|
||||
for token in doc:
|
||||
count += token.is_alpha
|
||||
|
||||
assert count == doc.count_by(IS_ALPHA).get(1, 0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user