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 +