2014-07-05 22:51:42 +04:00
|
|
|
from __future__ import unicode_literals
|
2014-12-23 03:40:32 +03:00
|
|
|
import pytest
|
2014-07-05 22:51:42 +04:00
|
|
|
|
2015-10-10 10:27:03 +03:00
|
|
|
from spacy.attrs import LEMMA, ORTH, PROB, IS_ALPHA
|
|
|
|
from spacy.parts_of_speech import NOUN, VERB
|
|
|
|
|
2014-07-05 22:51:42 +04:00
|
|
|
|
2015-06-07 19:02:24 +03:00
|
|
|
def test_neq(en_vocab):
|
|
|
|
addr = en_vocab['Hello']
|
|
|
|
assert en_vocab['bye'].orth != addr.orth
|
2014-07-05 22:51:42 +04:00
|
|
|
|
|
|
|
|
2015-06-07 19:02:24 +03:00
|
|
|
def test_eq(en_vocab):
|
|
|
|
addr = en_vocab['Hello']
|
|
|
|
assert en_vocab['Hello'].orth == addr.orth
|
2014-07-05 22:51:42 +04:00
|
|
|
|
|
|
|
|
2015-06-07 19:02:24 +03:00
|
|
|
def test_case_neq(en_vocab):
|
|
|
|
addr = en_vocab['Hello']
|
|
|
|
assert en_vocab['hello'].orth != addr.orth
|
2014-07-05 22:51:42 +04:00
|
|
|
|
|
|
|
|
2015-06-07 19:02:24 +03:00
|
|
|
def test_punct_neq(en_vocab):
|
|
|
|
addr = en_vocab['Hello']
|
|
|
|
assert en_vocab['Hello,'].orth != addr.orth
|
2014-07-05 22:51:42 +04:00
|
|
|
|
2014-12-23 03:40:32 +03:00
|
|
|
|
2015-06-07 19:02:24 +03:00
|
|
|
def test_shape_attr(en_vocab):
|
|
|
|
example = en_vocab['example']
|
2015-01-22 18:08:25 +03:00
|
|
|
assert example.orth != example.shape
|
2015-10-10 10:27:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
def test_symbols(en_vocab):
|
|
|
|
assert en_vocab.strings['IS_ALPHA'] == IS_ALPHA
|
|
|
|
assert en_vocab.strings['NOUN'] == NOUN
|
|
|
|
assert en_vocab.strings['VERB'] == VERB
|
|
|
|
assert en_vocab.strings['LEMMA'] == LEMMA
|
|
|
|
assert en_vocab.strings['ORTH'] == ORTH
|
|
|
|
assert en_vocab.strings['PROB'] == PROB
|
|
|
|
|