From 8c2a0c026dc257d8c37022df03c5b1f7b2f63019 Mon Sep 17 00:00:00 2001 From: ines Date: Sat, 13 May 2017 12:32:45 +0200 Subject: [PATCH] Fix parse_tree test --- spacy/tests/doc/test_doc_api.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spacy/tests/doc/test_doc_api.py b/spacy/tests/doc/test_doc_api.py index 6c8f61a81..1bc534ecd 100644 --- a/spacy/tests/doc/test_doc_api.py +++ b/spacy/tests/doc/test_doc_api.py @@ -217,11 +217,13 @@ def test_doc_api_has_vector(en_tokenizer, text_file, text, vectors): assert doc.has_vector -def test_parse_tree(EN): +def test_parse_tree(en_tokenizer): + """Tests doc.print_tree() method.""" text = 'I like New York in Autumn.' - EN = English(parser=False) - doc = EN(text, tag=True) - doc.from_array([HEAD], numpy.asarray([[1, 0, 1, -2, -3, -1, -5]], dtype='int32').T) + heads = [1, 0, 1, -2, -3, -1, -5] + tags = ['PRP', 'IN', 'NNP', 'NNP', 'IN', 'NNP', '.'] + tokens = en_tokenizer(text) + doc = get_doc(tokens.vocab, [t.text for t in tokens], heads=heads, tags=tags) # full method parse_tree(text) is a trivial composition trees = doc.print_tree() assert len(trees) > 0