from __future__ import unicode_literals

from ..util import get_doc

import pytest
import numpy

@pytest.mark.parametrize('sentence,matrix', [
    (
        'She created a test for spacy',
        numpy.array([
            [0, 1, 1, 1, 1, 1],
            [1, 1, 1, 1, 1, 1],
            [1, 1, 2, 3, 3, 3],
            [1, 1, 3, 3, 3, 3],
            [1, 1, 3, 3, 4, 4],
            [1, 1, 3, 3, 4, 5]], dtype=numpy.int32)
    )
    ])
def test_issue2396(EN, sentence, matrix):
    doc = EN(sentence)
    span = doc[:]
    assert (doc.get_lca_matrix() == matrix).all()
    assert (span.get_lca_matrix() == matrix).all()



from __future__ import unicode_literals

from ..util import get_doc

import pytest
import numpy
from numpy.testing import assert_array_equal


@pytest.mark.parametrize('words,heads,matrix', [
    (
        '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],
            [1, 1, 2, 3, 3, 3],
            [1, 1, 3, 3, 3, 3],
            [1, 1, 3, 3, 4, 4],
            [1, 1, 3, 3, 4, 5]], dtype=numpy.int32)
    )
    ])
def test_issue2396(en_vocab, words, heads, matrix):
    doc = get_doc(en_vocab, words=words, heads=heads)

    span = doc[:]
    assert_array_equal(doc.get_lca_matrix(), matrix)
    assert_array_equal(span.get_lca_matrix(), matrix)



Update get_lca_matrix test for develop
Update get_lca_matrix test for develop

  from __future__ import unicode_literals
  
  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],
              [1, 1, 2, 3, 3, 3],
              [1, 1, 3, 3, 3, 3],
              [1, 1, 3, 3, 4, 4],
              [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_array_equal(doc.get_lca_matrix(), matrix)
-     assert (span.get_lca_matrix() == matrix).all()
+     assert_array_equal(span.get_lca_matrix(), matrix)
  
  
  
Update get_lca_matrix test for develop
## Code Before:
from __future__ import unicode_literals

from ..util import get_doc

import pytest
import numpy

@pytest.mark.parametrize('sentence,matrix', [
    (
        'She created a test for spacy',
        numpy.array([
            [0, 1, 1, 1, 1, 1],
            [1, 1, 1, 1, 1, 1],
            [1, 1, 2, 3, 3, 3],
            [1, 1, 3, 3, 3, 3],
            [1, 1, 3, 3, 4, 4],
            [1, 1, 3, 3, 4, 5]], dtype=numpy.int32)
    )
    ])
def test_issue2396(EN, sentence, matrix):
    doc = EN(sentence)
    span = doc[:]
    assert (doc.get_lca_matrix() == matrix).all()
    assert (span.get_lca_matrix() == matrix).all()



## Instruction:
Update get_lca_matrix test for develop
## Code After:
from __future__ import unicode_literals

from ..util import get_doc

import pytest
import numpy
from numpy.testing import assert_array_equal


@pytest.mark.parametrize('words,heads,matrix', [
    (
        '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],
            [1, 1, 2, 3, 3, 3],
            [1, 1, 3, 3, 3, 3],
            [1, 1, 3, 3, 4, 4],
            [1, 1, 3, 3, 4, 5]], dtype=numpy.int32)
    )
    ])
def test_issue2396(en_vocab, words, heads, matrix):
    doc = get_doc(en_vocab, words=words, heads=heads)

    span = doc[:]
    assert_array_equal(doc.get_lca_matrix(), matrix)
    assert_array_equal(span.get_lca_matrix(), matrix)


