File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -659,11 +659,15 @@ def test_re_escape_non_ascii_bytes(self):
659659 res = re .findall (re .escape ('\u2620 ' .encode ('utf-8' )), b )
660660 self .assertEqual (len (res ), 2 )
661661
662- def pickle_test (self , pickle ):
663- oldpat = re .compile ('a(?:b|(c|e){1,2}?|d)+?(.)' )
664- s = pickle .dumps (oldpat )
665- newpat = pickle .loads (s )
666- self .assertEqual (oldpat , newpat )
662+ def test_pickling (self ):
663+ import pickle
664+ oldpat = re .compile ('a(?:b|(c|e){1,2}?|d)+?(.)' , re .UNICODE )
665+ for proto in range (pickle .HIGHEST_PROTOCOL + 1 ):
666+ pickled = pickle .dumps (oldpat , proto )
667+ newpat = pickle .loads (pickled )
668+ self .assertEqual (newpat , oldpat )
669+ # current pickle expects the _compile() reconstructor in re module
670+ from re import _compile
667671
668672 def test_constants (self ):
669673 self .assertEqual (re .I , re .IGNORECASE )
You can’t perform that action at this time.
0 commit comments