From d17a15ae668157cd11a4d6c5ed3ece5fac50c25c Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 28 Jul 2015 21:04:00 +0200 Subject: [PATCH] * Add test to check parse is being deserialized properly --- tests/serialize/test_io.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/serialize/test_io.py b/tests/serialize/test_io.py index 1881e7486..a64d0cabc 100644 --- a/tests/serialize/test_io.py +++ b/tests/serialize/test_io.py @@ -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 +