@@ -318,7 +318,8 @@ def test_exact_type_match(self):
318
318
# >>> class Int(int): pass
319
319
# >>> type(loads(dumps(Int())))
320
320
# <type 'int'>
321
- for typ in (int , float , complex , tuple , list , dict , set , frozenset ):
321
+ for typ in (int , float , complex , tuple , list , dict , set , frozenset ,
322
+ imaginary ):
322
323
# Note: str subclasses are not tested because they get handled
323
324
# by marshal's routines for objects supporting the buffer API.
324
325
subtyp = type ('subtyp' , (typ ,), {})
@@ -372,7 +373,7 @@ def readinto(self, buf):
372
373
if n is not None and n > 4 :
373
374
n += 10 ** 6
374
375
return n
375
- for value in (1.0 , 1j , b'0123456789' , '0123456789' ):
376
+ for value in (1.0 , 1j , 1 + 1j , b'0123456789' , '0123456789' ):
376
377
self .assertRaises (ValueError , marshal .load ,
377
378
BadReader (marshal .dumps (value )))
378
379
@@ -628,7 +629,7 @@ def test_write_long_to_file(self):
628
629
self .assertEqual (data , b'\x78 \x56 \x34 \x12 ' )
629
630
630
631
def test_write_object_to_file (self ):
631
- obj = ('\u20ac ' , b'abc' , 123 , 45.6 , 7 + 8j , 'long line ' * 1000 )
632
+ obj = ('\u20ac ' , b'abc' , 123 , 45.6 , 7 + 8j , 122j , 'long line ' * 1000 )
632
633
for v in range (marshal .version + 1 ):
633
634
_testcapi .pymarshal_write_object_to_file (obj , os_helper .TESTFN , v )
634
635
with open (os_helper .TESTFN , 'rb' ) as f :
@@ -665,7 +666,7 @@ def test_read_long_from_file(self):
665
666
os_helper .unlink (os_helper .TESTFN )
666
667
667
668
def test_read_last_object_from_file (self ):
668
- obj = ('\u20ac ' , b'abc' , 123 , 45.6 , 7 + 8j )
669
+ obj = ('\u20ac ' , b'abc' , 123 , 45.6 , 7 + 8j , 666j )
669
670
for v in range (marshal .version + 1 ):
670
671
data = marshal .dumps (obj , v )
671
672
with open (os_helper .TESTFN , 'wb' ) as f :
@@ -681,7 +682,7 @@ def test_read_last_object_from_file(self):
681
682
os_helper .unlink (os_helper .TESTFN )
682
683
683
684
def test_read_object_from_file (self ):
684
- obj = ('\u20ac ' , b'abc' , 123 , 45.6 , 7 + 8j )
685
+ obj = ('\u20ac ' , b'abc' , 123 , 45.6 , 7 + 8j , 1j )
685
686
for v in range (marshal .version + 1 ):
686
687
data = marshal .dumps (obj , v )
687
688
with open (os_helper .TESTFN , 'wb' ) as f :
0 commit comments