* Make some of the website tests work without models

This commit is contained in:
Matthew Honnibal 2016-01-18 18:14:44 +01:00
parent 334c4b2b57
commit e825fd9554
1 changed files with 5 additions and 6 deletions

View File

@ -1,5 +1,7 @@
from __future__ import unicode_literals
import pytest
from spacy.attrs import HEAD
import numpy
@pytest.mark.xfail
@ -99,7 +101,9 @@ def test_example_i_like_new_york1(nlp):
@pytest.fixture
def toks(nlp):
return nlp('I like New York in Autumn.')
doc = nlp('I like New York in Autumn.')
doc.from_array([HEAD], numpy.asarray([[1, 0, 1, -2, -3, -1, -5]], dtype='int32').T)
return doc
def test_example_i_like_new_york2(toks):
@ -132,19 +136,16 @@ def dot(toks):
return tok(toks, "dot")
@pytest.mark.models
def test_example_i_like_new_york3(toks, new, york):
assert toks[new].head.orth_ == 'York'
assert toks[york].head.orth_ == 'like'
@pytest.mark.models
def test_example_i_like_new_york4(toks, new, york):
new_york = toks[new:york+1]
assert new_york.root.orth_ == 'York'
@pytest.mark.models
def test_example_i_like_new_york5(toks, autumn, dot):
assert toks[autumn].head.orth_ == 'in'
assert toks[dot].head.orth_ == 'like'
@ -152,7 +153,6 @@ def test_example_i_like_new_york5(toks, autumn, dot):
assert autumn_dot.root.orth_ == 'Autumn'
@pytest.mark.models
def test_navigating_the_parse_tree_lefts(doc):
# TODO: where does the span object come from?
span = doc[:2]
@ -160,7 +160,6 @@ def test_navigating_the_parse_tree_lefts(doc):
if span.doc[i].head in span]
@pytest.mark.models
def test_navigating_the_parse_tree_rights(doc):
span = doc[:2]
rights = [span.doc[i] for i in range(span.end, len(span.doc))