spaCy/spacy/tests/regression/test_issue2833.py

16 lines
440 B
Python
Raw Normal View History

# coding: utf-8
from __future__ import unicode_literals
import pytest
from spacy.tokens import Doc
from spacy.compat import pickle
def test_issue2833(en_vocab):
2019-02-13 15:22:05 +03:00
"""Test that a custom error is raised if a token or span is pickled."""
doc = Doc(en_vocab, words=["Hello", "world"])
with pytest.raises(NotImplementedError):
pickle.dumps(doc[0])
2019-02-13 15:22:05 +03:00
with pytest.raises(NotImplementedError):
pickle.dumps(doc[0:2])