Update get_lca_matrix test for develop

This commit is contained in:
Matthew Honnibal 2018-12-30 14:27:04 +01:00
parent ac9e3a4a8b
commit 3d64eb4a74
1 changed files with 10 additions and 6 deletions

View File

@ -5,10 +5,13 @@ from ..util import get_doc
import pytest import pytest
import numpy 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([ numpy.array([
[0, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1],
[1, 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) [1, 1, 3, 3, 4, 5]], dtype=numpy.int32)
) )
]) ])
def test_issue2396(EN, sentence, matrix): def test_issue2396(en_vocab, words, heads, matrix):
doc = EN(sentence) doc = get_doc(en_vocab, words=words, heads=heads)
span = doc[:] span = doc[:]
assert (doc.get_lca_matrix() == matrix).all() assert_array_equal(doc.get_lca_matrix(), matrix)
assert (span.get_lca_matrix() == matrix).all() assert_array_equal(span.get_lca_matrix(), matrix)