From 7b1ddcc04da5e4bc366cc6bba0d14924e1999782 Mon Sep 17 00:00:00 2001 From: ines Date: Mon, 29 May 2017 01:08:10 +0200 Subject: [PATCH] Add test for vocab serialization --- spacy/tests/serialize/test_serialization.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spacy/tests/serialize/test_serialization.py b/spacy/tests/serialize/test_serialization.py index 52c42b94d..036035095 100644 --- a/spacy/tests/serialize/test_serialization.py +++ b/spacy/tests/serialize/test_serialization.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from ..util import get_doc, assert_docs_equal from ...tokens import Doc +from ...vocab import Vocab import pytest @@ -22,6 +23,15 @@ def test_serialize_empty_doc(en_vocab): for token1, token2 in zip(doc, doc2): assert token1.text == token2.text + +@pytest.mark.xfail +@pytest.mark.parametrize('text', ['rat']) +def test_serialize_vocab(en_vocab, text): + text_hash = en_vocab.strings.add(text) + vocab_bytes = en_vocab.to_bytes() + new_vocab = Vocab().from_bytes(vocab_bytes) + assert new_vocab.strings(text_hash) == text + # #@pytest.mark.parametrize('text', [TEXT]) #def test_serialize_tokens(en_vocab, text):