From bee2e7798381895fa20dfe3870e5fd2e8f1b14ab Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 23 Jul 2015 09:26:43 +0200 Subject: [PATCH] * Update tests --- tests/parser/test_parse.py | 1 + tests/parser/test_parse_navigate.py | 3 +++ tests/parser/test_subtree.py | 2 ++ tests/spans/test_span.py | 2 ++ tests/tagger/test_add_lemmas.py | 1 + tests/tagger/test_morph_exceptions.py | 1 + tests/tagger/test_tag_names.py | 2 ++ tests/tokens/test_array.py | 2 ++ tests/tokens/test_token.py | 1 + tests/tokens/test_token_references.py | 3 +++ 10 files changed, 18 insertions(+) diff --git a/tests/parser/test_parse.py b/tests/parser/test_parse.py index e12dfbb8d..e99148933 100644 --- a/tests/parser/test_parse.py +++ b/tests/parser/test_parse.py @@ -1,6 +1,7 @@ import pytest +@pytest.mark.models def test_root(EN): tokens = EN(u"i don't have other assistance") for t in tokens: diff --git a/tests/parser/test_parse_navigate.py b/tests/parser/test_parse_navigate.py index ebd550fa2..a1c8b1a87 100644 --- a/tests/parser/test_parse_navigate.py +++ b/tests/parser/test_parse_navigate.py @@ -12,6 +12,7 @@ def sun_text(): return text +@pytest.mark.models def test_consistency(EN, sun_text): tokens = EN(sun_text) for head in tokens: @@ -21,6 +22,7 @@ def test_consistency(EN, sun_text): assert child.head is head +@pytest.mark.models def test_child_consistency(EN, sun_text): tokens = EN(sun_text) @@ -53,6 +55,7 @@ def test_child_consistency(EN, sun_text): assert not children +@pytest.mark.models def test_edges(EN): sun_text = u"Chemically, about three quarters of the Sun's mass consists of hydrogen, while the rest is mostly helium." tokens = EN(sun_text) diff --git a/tests/parser/test_subtree.py b/tests/parser/test_subtree.py index 91f3d9ce5..8502a0ac9 100644 --- a/tests/parser/test_subtree.py +++ b/tests/parser/test_subtree.py @@ -1,6 +1,8 @@ from __future__ import unicode_literals +import pytest +@pytest.mark.models def test_subtrees(EN): sent = EN('The four wheels on the bus turned quickly') wheels = sent[2] diff --git a/tests/spans/test_span.py b/tests/spans/test_span.py index d7f48e080..14809e4dd 100644 --- a/tests/spans/test_span.py +++ b/tests/spans/test_span.py @@ -9,6 +9,7 @@ def doc(EN): return EN('This is a sentence. This is another sentence. And a third.') +@pytest.mark.models def test_sent_spans(doc): sents = list(doc.sents) assert sents[0].start == 0 @@ -17,6 +18,7 @@ def test_sent_spans(doc): assert sum(len(sent) for sent in sents) == len(doc) +@pytest.mark.models def test_root(doc): np = doc[2:4] assert len(np) == 2 diff --git a/tests/tagger/test_add_lemmas.py b/tests/tagger/test_add_lemmas.py index b89d62503..1895310cf 100644 --- a/tests/tagger/test_add_lemmas.py +++ b/tests/tagger/test_add_lemmas.py @@ -17,6 +17,7 @@ def lemmas(tagged): return [t.lemma_ for t in tagged] +@pytest.mark.models def test_lemmas(lemmas, tagged): assert lemmas[0] == 'banana' assert lemmas[1] == 'in' diff --git a/tests/tagger/test_morph_exceptions.py b/tests/tagger/test_morph_exceptions.py index 088947603..0dc3c6ad5 100644 --- a/tests/tagger/test_morph_exceptions.py +++ b/tests/tagger/test_morph_exceptions.py @@ -12,6 +12,7 @@ def morph_exc(): } +@pytest.mark.models def test_load_exc(morph_exc): # Do this local as we want to modify it nlp = English() diff --git a/tests/tagger/test_tag_names.py b/tests/tagger/test_tag_names.py index c340df0f7..37e6d9318 100644 --- a/tests/tagger/test_tag_names.py +++ b/tests/tagger/test_tag_names.py @@ -1,7 +1,9 @@ from spacy.en import English import six +import pytest +@pytest.mark.models def test_tag_names(EN): tokens = EN(u'I ate pizzas with anchovies.', parse=False, tag=True) pizza = tokens[2] diff --git a/tests/tokens/test_array.py b/tests/tokens/test_array.py index c7e542edb..29807c3e5 100644 --- a/tests/tokens/test_array.py +++ b/tests/tokens/test_array.py @@ -15,6 +15,7 @@ def test_attr_of_token(EN): assert feats_array[0][0] != feats_array[0][1] +@pytest.mark.models def test_tag(EN): text = u'A nice sentence.' tokens = EN(text) @@ -26,6 +27,7 @@ def test_tag(EN): assert feats_array[3][1] == tokens[3].tag +@pytest.mark.models def test_dep(EN): text = u'A nice sentence.' tokens = EN(text) diff --git a/tests/tokens/test_token.py b/tests/tokens/test_token.py index 14dfb31b6..c2092564c 100644 --- a/tests/tokens/test_token.py +++ b/tests/tokens/test_token.py @@ -4,6 +4,7 @@ import pytest from spacy.parts_of_speech import ADV +@pytest.mark.models def test_prob(EN): tokens = EN(u'Give it back', parse=False) give = tokens[0] diff --git a/tests/tokens/test_token_references.py b/tests/tokens/test_token_references.py index fd5444623..a380a2b19 100644 --- a/tests/tokens/test_token_references.py +++ b/tests/tokens/test_token_references.py @@ -9,6 +9,7 @@ data_dir = os.environ.get('SPACY_DATA', LOCAL_DATA_DIR) # Let this have its own instances, as we have to be careful about memory here # that's the point, after all +@pytest.mark.models def get_orphan_token(text, i): nlp = English(load_vectors=False, data_dir=data_dir) tokens = nlp(text) @@ -18,6 +19,7 @@ def get_orphan_token(text, i): return token +@pytest.mark.models def test_orphan(): orphan = get_orphan_token('An orphan token', 1) gc.collect() @@ -36,6 +38,7 @@ def _orphan_from_list(toks): return lst +@pytest.mark.models def test_list_orphans(): # Test case from NSchrading nlp = English(load_vectors=False, data_dir=data_dir)