mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
		
			440 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			440 B
		
	
	
	
		
			Python
		
	
	
	
	
	
# 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):
 | 
						|
    """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])
 | 
						|
    with pytest.raises(NotImplementedError):
 | 
						|
        pickle.dumps(doc[0:2])
 |