mirror of https://github.com/explosion/spaCy.git
* Update tests
This commit is contained in:
parent
4af2595d99
commit
bee2e77983
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue