From e825fd95542adb7115b38b345aa4279a7a21eb73 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 18 Jan 2016 18:14:44 +0100 Subject: [PATCH] * Make some of the website tests work without models --- spacy/tests/website/test_api.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spacy/tests/website/test_api.py b/spacy/tests/website/test_api.py index 39eb38dd6..6a7379d87 100644 --- a/spacy/tests/website/test_api.py +++ b/spacy/tests/website/test_api.py @@ -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))