* Add test to check parse is being deserialized properly

This commit is contained in:
Matthew Honnibal 2015-07-28 21:04:00 +02:00
parent b5132bed7d
commit d17a15ae66

View File

@ -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