2014-09-25 20:29:42 +04:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2014-12-23 03:40:32 +03:00
|
|
|
from spacy.en.attrs import *
|
2014-09-25 20:29:42 +04:00
|
|
|
|
|
|
|
|
2015-06-07 19:02:24 +03:00
|
|
|
def test_is_alpha(en_vocab):
|
|
|
|
the = en_vocab['the']
|
2015-01-14 16:33:16 +03:00
|
|
|
assert the.flags & (1 << IS_ALPHA)
|
2015-06-07 19:02:24 +03:00
|
|
|
year = en_vocab['1999']
|
2015-01-14 16:33:16 +03:00
|
|
|
assert not year.flags & (1 << IS_ALPHA)
|
2015-06-07 19:02:24 +03:00
|
|
|
mixed = en_vocab['hello1']
|
2015-01-14 16:33:16 +03:00
|
|
|
assert not mixed.flags & (1 << IS_ALPHA)
|
2014-09-25 20:29:42 +04:00
|
|
|
|
|
|
|
|
2015-06-07 19:02:24 +03:00
|
|
|
def test_is_digit(en_vocab):
|
|
|
|
the = en_vocab['the']
|
2015-01-14 16:33:16 +03:00
|
|
|
assert not the.flags & (1 << IS_DIGIT)
|
2015-06-07 19:02:24 +03:00
|
|
|
year = en_vocab['1999']
|
2015-01-14 16:33:16 +03:00
|
|
|
assert year.flags & (1 << IS_DIGIT)
|
2015-06-07 19:02:24 +03:00
|
|
|
mixed = en_vocab['hello1']
|
2015-01-14 16:33:16 +03:00
|
|
|
assert not mixed.flags & (1 << IS_DIGIT)
|