@@ -340,19 +340,19 @@ def test_object_delattrstring(self):
340
340
# CRASHES delattrstring(NULL, b'a')
341
341
342
342
def test_copy_to_object (self ):
343
- s1 = _testcapi .object_copy_to_object (bytes (5 ), 'abcde' , 'C' )
344
- s2 = _testcapi .object_copy_to_object (bytes (5 ), 'abcde' , 'F' )
345
- s3 = _testcapi .object_copy_to_object (bytes (5 ), 'abcde' , 'A' )
346
- try :
347
- _testcapi .object_copy_to_object (bytes (4 ), 'abcde' , 'A' )
348
- _testcapi .object_copy_to_object (list (), 'abcde' , 'A' )
349
- except BufferError as e :
350
- self .assertIsInstance (e , BufferError )
351
- except TypeError as e :
352
- self .assertIsInstance (e , TypeError )
343
+ copy_to_object = _testcapi .object_copy_to_object
344
+ s1 = copy_to_object (bytes (3 ), 'abc' , 'C' )
345
+ s2 = copy_to_object (bytes (3 ), 'abc' , 'F' )
346
+ s3 = copy_to_object (bytes (3 ), 'abc' , 'A' )
353
347
self .assertEqual (s1 , s2 )
354
348
self .assertEqual (s2 , s3 )
355
349
self .assertEqual (s1 , s3 )
350
+ self .assertRaises (BufferError , copy_to_object , bytes (2 ), 'abc' , 'C' )
351
+ self .assertRaises (BufferError , copy_to_object , bytes (2 ), 'abc' , 'F' )
352
+ self .assertRaises (BufferError , copy_to_object , bytes (2 ), 'abc' , 'A' )
353
+ self .assertRaises (TypeError , copy_to_object , list (), 'abc' , 'C' )
354
+ self .assertRaises (TypeError , copy_to_object , list (), 'abc' , 'F' )
355
+ self .assertRaises (TypeError , copy_to_object , list (), 'abc' , 'A' )
356
356
357
357
def test_mapping_check (self ):
358
358
check = _testlimitedcapi .mapping_check
0 commit comments