diff --git a/spacy/tests/regression/test_issue4528.py b/spacy/tests/regression/test_issue4528.py index fa678495e..460449003 100644 --- a/spacy/tests/regression/test_issue4528.py +++ b/spacy/tests/regression/test_issue4528.py @@ -1,11 +1,9 @@ # coding: utf8 from __future__ import unicode_literals -import pytest from spacy.tokens import Doc, DocBin -@pytest.mark.xfail def test_issue4528(en_vocab): """Test that user_data is correctly serialized in DocBin.""" doc = Doc(en_vocab, words=["hello", "world"]) diff --git a/spacy/tokens/_serialize.py b/spacy/tokens/_serialize.py index 3ca3028b6..18cb8a234 100644 --- a/spacy/tokens/_serialize.py +++ b/spacy/tokens/_serialize.py @@ -103,7 +103,8 @@ class DocBin(object): doc = Doc(vocab, words=words, spaces=spaces) doc = doc.from_array(self.attrs, tokens) if self.store_user_data: - doc.user_data.update(srsly.msgpack_loads(self.user_data[i])) + user_data = srsly.msgpack_loads(self.user_data[i], use_list=False) + doc.user_data.update(user_data) yield doc def merge(self, other):