From b5b31c6b6ee70f18b8c274dbcf2cf7fa2a61a931 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 10 Sep 2014 20:58:30 +0200 Subject: [PATCH] * Avoid testing for object identity --- tests/test_tokenizer.py | 6 +++--- tests/test_vocab.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_tokenizer.py b/tests/test_tokenizer.py index 4b0dde524..50b0dae71 100644 --- a/tests/test_tokenizer.py +++ b/tests/test_tokenizer.py @@ -5,14 +5,14 @@ from spacy.en import EN def test_single_word(): 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(): words = EN.tokenize('hello possums') assert len(words) == 2 - assert words[0] == EN.lexicon.lookup('hello') - assert words[0] != words[1] + assert words[0].string == EN.lexicon.lookup('hello').string + assert words[0].string != words[1].string def test_punct(): diff --git a/tests/test_vocab.py b/tests/test_vocab.py index 706a7ee07..cd7bf42e1 100644 --- a/tests/test_vocab.py +++ b/tests/test_vocab.py @@ -5,12 +5,12 @@ from spacy.en import EN def test_neq(): addr = EN.lookup('Hello') - assert EN.lookup('bye') != addr + assert EN.lookup('bye').string != addr.string def test_eq(): addr = EN.lookup('Hello') - assert EN.lookup('Hello') == addr + assert EN.lookup('Hello').string == addr.string def test_round_trip(): @@ -20,12 +20,12 @@ def test_round_trip(): def test_case_neq(): addr = EN.lookup('Hello') - assert EN.lookup('hello') != addr + assert EN.lookup('hello').string != addr.string def test_punct_neq(): addr = EN.lookup('Hello') - assert EN.lookup('Hello,') != addr + assert EN.lookup('Hello,').string != addr.string def test_short():