diff --git a/tests/test_add_lemmas.py b/tests/test_add_lemmas.py index 01c410b90..cce3f3843 100644 --- a/tests/test_add_lemmas.py +++ b/tests/test_add_lemmas.py @@ -11,7 +11,7 @@ def EN(): @pytest.fixture def tagged(EN): string = u'Bananas in pyjamas are geese.' - tokens = EN(string, tag=True) + tokens = EN(string, tag=True, parse=False) return tokens diff --git a/tests/test_array.py b/tests/test_array.py index b6f0620c5..6d9b2b22c 100644 --- a/tests/test_array.py +++ b/tests/test_array.py @@ -11,7 +11,7 @@ EN = English() def test_attr_of_token(): text = u'An example sentence.' - tokens = EN(text) + tokens = EN(text, tag=True, parse=False) example = EN.vocab[u'example'] assert example.orth != example.shape feats_array = tokens.to_array((attrs.ORTH, attrs.SHAPE)) diff --git a/tests/test_conjuncts.py b/tests/test_conjuncts.py index 480aee457..b6d7cc934 100644 --- a/tests/test_conjuncts.py +++ b/tests/test_conjuncts.py @@ -11,7 +11,7 @@ def orths(tokens): def test_simple_two(): - tokens = NLU('I lost money and pride.') + tokens = NLU('I lost money and pride.', tag=True, parse=False) pride = tokens[4] assert orths(pride.conjuncts) == ['money', 'pride'] money = tokens[2] diff --git a/tests/test_contractions.py b/tests/test_contractions.py index c20b47883..3d0ee11ee 100644 --- a/tests/test_contractions.py +++ b/tests/test_contractions.py @@ -3,26 +3,23 @@ import pytest from spacy.en import English -@pytest.fixture -def EN(): - return English() +EN = English() - -def test_possess(EN): - tokens = EN("Mike's", parse=False) +def test_possess(): + tokens = EN("Mike's", parse=False, tag=False) assert EN.vocab.strings[tokens[0].orth] == "Mike" assert EN.vocab.strings[tokens[1].orth] == "'s" assert len(tokens) == 2 -def test_apostrophe(EN): - tokens = EN("schools'") +def test_apostrophe(): + tokens = EN("schools'", parse=False, tag=False) assert len(tokens) == 2 assert tokens[1].orth_ == "'" assert tokens[0].orth_ == "schools" -def test_LL(EN): +def test_LL(): tokens = EN("we'll", parse=False) assert len(tokens) == 2 assert tokens[1].orth_ == "'ll" @@ -30,7 +27,7 @@ def test_LL(EN): assert tokens[0].orth_ == "we" -def test_aint(EN): +def test_aint(): tokens = EN("ain't", parse=False) assert len(tokens) == 2 assert tokens[0].orth_ == "ai" @@ -39,7 +36,7 @@ def test_aint(EN): assert tokens[1].lemma_ == "not" -def test_capitalized(EN): +def test_capitalized(): tokens = EN("can't", parse=False) assert len(tokens) == 2 tokens = EN("Can't", parse=False) @@ -50,7 +47,7 @@ def test_capitalized(EN): assert tokens[0].lemma_ == "be" -def test_punct(EN): +def test_punct(): tokens = EN("We've", parse=False) assert len(tokens) == 2 tokens = EN("``We've", parse=False) diff --git a/tests/test_emoticons.py b/tests/test_emoticons.py index 98ce58296..75b2b1060 100644 --- a/tests/test_emoticons.py +++ b/tests/test_emoticons.py @@ -11,7 +11,7 @@ def EN(): def test_tweebo_challenge(EN): text = u""":o :/ :'( >:o (: :) >.< XD -__- o.O ;D :-) @_@ :P 8D :1 >:( :D =| ") :> ....""" - tokens = EN(text) + tokens = EN(text, parse=False, tag=False) assert tokens[0].orth_ == ":o" assert tokens[1].orth_ == ":/" assert tokens[2].orth_ == ":'(" diff --git a/tests/test_infix.py b/tests/test_infix.py index d52996e33..1b188e88a 100644 --- a/tests/test_infix.py +++ b/tests/test_infix.py @@ -12,7 +12,7 @@ from spacy.en import English def test_period(): EN = English() - tokens = EN('best.Known') + tokens = EN.tokenizer('best.Known') assert len(tokens) == 3 tokens = EN('zombo.com') assert len(tokens) == 1 diff --git a/tests/test_morph_exceptions.py b/tests/test_morph_exceptions.py index c2dbbc7d0..2b34c9ec5 100644 --- a/tests/test_morph_exceptions.py +++ b/tests/test_morph_exceptions.py @@ -20,7 +20,7 @@ def morph_exc(): def test_load_exc(EN, morph_exc): EN.tagger.load_morph_exceptions(morph_exc) - tokens = EN('I like his style.', tag=True) + tokens = EN('I like his style.', tag=True, parse=False) his = tokens[2] assert his.tag_ == 'PRP$' assert his.lemma_ == '-PRP-' diff --git a/tests/test_post_punct.py b/tests/test_post_punct.py index 1d29a6ed6..95b32f261 100644 --- a/tests/test_post_punct.py +++ b/tests/test_post_punct.py @@ -19,7 +19,7 @@ def test_close(close_puncts, EN): word_str = 'Hello' for p in close_puncts: string = word_str + p - tokens = EN(string) + tokens = EN(string, parse=False, tag=False) assert len(tokens) == 2 assert tokens[1].string == p assert tokens[0].string == word_str @@ -29,7 +29,7 @@ def test_two_different_close(close_puncts, EN): word_str = 'Hello' for p in close_puncts: string = word_str + p + "'" - tokens = EN(string) + tokens = EN(string, parse=False, tag=False) assert len(tokens) == 3 assert tokens[0].string == word_str assert tokens[1].string == p @@ -40,12 +40,12 @@ def test_three_same_close(close_puncts, EN): word_str = 'Hello' for p in close_puncts: string = word_str + p + p + p - tokens = EN(string) + tokens = EN(string, tag=False, parse=False) assert len(tokens) == 4 assert tokens[0].string == word_str assert tokens[1].string == p def test_double_end_quote(EN): - assert len(EN("Hello''")) == 2 - assert len(EN("''")) == 1 + assert len(EN("Hello''", tag=False, parse=False)) == 2 + assert len(EN("''", tag=False, parse=False)) == 1 diff --git a/tests/test_surround_punct.py b/tests/test_surround_punct.py index 65ef0209f..fb6a6beb1 100644 --- a/tests/test_surround_punct.py +++ b/tests/test_surround_punct.py @@ -12,7 +12,7 @@ def paired_puncts(): @pytest.fixture def EN(): - return English() + return English().tokenizer def test_token(paired_puncts, EN): diff --git a/tests/test_whitespace.py b/tests/test_whitespace.py index 19a453c51..eb87881dd 100644 --- a/tests/test_whitespace.py +++ b/tests/test_whitespace.py @@ -7,7 +7,7 @@ import pytest @pytest.fixture def EN(): - return English() + return English().tokenizer def test_single_space(EN):