mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-24 00:04:15 +03:00
* Add test to check parse is being deserialized properly
This commit is contained in:
parent
b5132bed7d
commit
d17a15ae66
|
@ -22,3 +22,19 @@ def test_read_write(EN):
|
|||
|
||||
assert r1.string == doc1.string
|
||||
assert r2.string == doc2.string
|
||||
|
||||
|
||||
@pytest.mark.models
|
||||
def test_left_right(EN):
|
||||
orig = EN(u'This is a simple test. With a couple of sentences.')
|
||||
result = Doc(orig.vocab).from_bytes(orig.to_bytes())
|
||||
|
||||
for word in result:
|
||||
assert word.head.i == orig[word.i].head.i
|
||||
if word.head is not word:
|
||||
assert word.i in [w.i for w in word.head.children]
|
||||
for child in word.lefts:
|
||||
assert child.head.i == word.i
|
||||
for child in word.rights:
|
||||
assert child.head.i == word.i
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user