From 4d4d2c0db408de0bf5fdf047f2fa24c6d113c68a Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 21 Dec 2014 21:05:28 +1100 Subject: [PATCH] * Upd test --- tests/test_lexeme_flags.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/test_lexeme_flags.py b/tests/test_lexeme_flags.py index c1fe2d847..3ab123039 100644 --- a/tests/test_lexeme_flags.py +++ b/tests/test_lexeme_flags.py @@ -2,25 +2,28 @@ from __future__ import unicode_literals import pytest -from spacy.en import * -from spacy.lexeme import * +from spacy.en import English +from spacy.en.attrs import IS_ALPHA, IS_DIGIT -def test_is_alpha(): - EN.load() - the = EN.lexicon['the'] +@pytest.fixture +def EN(): + return English(pos_tag=False) + + +def test_is_alpha(EN): + the = EN.vocab['the'] assert the['flags'] & (1 << IS_ALPHA) - year = EN.lexicon['1999'] + year = EN.vocab['1999'] assert not year['flags'] & (1 << IS_ALPHA) - mixed = EN.lexicon['hello1'] + mixed = EN.vocab['hello1'] assert not mixed['flags'] & (1 << IS_ALPHA) -def test_is_digit(): - EN.load() - the = EN.lexicon['the'] +def test_is_digit(EN): + the = EN.vocab['the'] assert not the['flags'] & (1 << IS_DIGIT) - year = EN.lexicon['1999'] + year = EN.vocab['1999'] assert year['flags'] & (1 << IS_DIGIT) - mixed = EN.lexicon['hello1'] + mixed = EN.vocab['hello1'] assert not mixed['flags'] & (1 << IS_DIGIT)