From 3d64eb4a7438b6b4f46f1fdf7f47d530cb11b09c Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 30 Dec 2018 14:27:04 +0100 Subject: [PATCH] Update get_lca_matrix test for develop --- spacy/tests/regression/test_issue2396.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/spacy/tests/regression/test_issue2396.py b/spacy/tests/regression/test_issue2396.py index c3ff04225..413208599 100644 --- a/spacy/tests/regression/test_issue2396.py +++ b/spacy/tests/regression/test_issue2396.py @@ -5,10 +5,13 @@ from ..util import get_doc import pytest import numpy +from numpy.testing import assert_array_equal -@pytest.mark.parametrize('sentence,matrix', [ + +@pytest.mark.parametrize('words,heads,matrix', [ ( - 'She created a test for spacy', + 'She created a test for spacy'.split(), + [1, 0, 1, -2, -1, -1], numpy.array([ [0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], @@ -18,10 +21,11 @@ import numpy [1, 1, 3, 3, 4, 5]], dtype=numpy.int32) ) ]) -def test_issue2396(EN, sentence, matrix): - doc = EN(sentence) +def test_issue2396(en_vocab, words, heads, matrix): + doc = get_doc(en_vocab, words=words, heads=heads) + span = doc[:] - assert (doc.get_lca_matrix() == matrix).all() - assert (span.get_lca_matrix() == matrix).all() + assert_array_equal(doc.get_lca_matrix(), matrix) + assert_array_equal(span.get_lca_matrix(), matrix)