* Add test for Issue #44

This commit is contained in:
Matthew Honnibal 2015-04-07 06:05:18 +02:00
parent 6640386b25
commit 085574ccc1

View File

@ -6,9 +6,9 @@ from spacy.en.attrs import IS_STOP
import pytest import pytest
nlp = English()
@pytest.fixture @pytest.fixture
def token(): def token():
nlp = English()
tokens = nlp(u'Give it back! He pleaded.') tokens = nlp(u'Give it back! He pleaded.')
return tokens[0] return tokens[0]
@ -29,3 +29,11 @@ def test_flags(token):
assert token.check_flag(IS_ALPHA) assert token.check_flag(IS_ALPHA)
assert not token.check_flag(IS_DIGIT) assert not token.check_flag(IS_DIGIT)
# TODO: Test more of these, esp. if a bug is found # TODO: Test more of these, esp. if a bug is found
def test_single_token_string():
nlp = English()
tokens = nlp(u'foobar')
assert tokens[0].string == 'foobar'