* Avoid testing for object identity

This commit is contained in:
Matthew Honnibal 2014-09-10 20:58:30 +02:00
parent e567713429
commit b5b31c6b6e
2 changed files with 7 additions and 7 deletions

View File

@ -5,14 +5,14 @@ from spacy.en import EN
def test_single_word(): def test_single_word():
lex_ids = EN.tokenize(u'hello') lex_ids = EN.tokenize(u'hello')
assert lex_ids[0] == EN.lexicon.lookup(u'hello') assert lex_ids[0].string == EN.lexicon.lookup(u'hello').string
def test_two_words(): def test_two_words():
words = EN.tokenize('hello possums') words = EN.tokenize('hello possums')
assert len(words) == 2 assert len(words) == 2
assert words[0] == EN.lexicon.lookup('hello') assert words[0].string == EN.lexicon.lookup('hello').string
assert words[0] != words[1] assert words[0].string != words[1].string
def test_punct(): def test_punct():

View File

@ -5,12 +5,12 @@ from spacy.en import EN
def test_neq(): def test_neq():
addr = EN.lookup('Hello') addr = EN.lookup('Hello')
assert EN.lookup('bye') != addr assert EN.lookup('bye').string != addr.string
def test_eq(): def test_eq():
addr = EN.lookup('Hello') addr = EN.lookup('Hello')
assert EN.lookup('Hello') == addr assert EN.lookup('Hello').string == addr.string
def test_round_trip(): def test_round_trip():
@ -20,12 +20,12 @@ def test_round_trip():
def test_case_neq(): def test_case_neq():
addr = EN.lookup('Hello') addr = EN.lookup('Hello')
assert EN.lookup('hello') != addr assert EN.lookup('hello').string != addr.string
def test_punct_neq(): def test_punct_neq():
addr = EN.lookup('Hello') addr = EN.lookup('Hello')
assert EN.lookup('Hello,') != addr assert EN.lookup('Hello,').string != addr.string
def test_short(): def test_short():