Skip to content

Commit 4632163

Browse files
committed
Change test
1 parent 49ae371 commit 4632163

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Lib/test/test_capi/test_abstract.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -340,19 +340,19 @@ def test_object_delattrstring(self):
340340
# CRASHES delattrstring(NULL, b'a')
341341

342342
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')
353347
self.assertEqual(s1, s2)
354348
self.assertEqual(s2, s3)
355349
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')
356356

357357
def test_mapping_check(self):
358358
check = _testlimitedcapi.mapping_check

0 commit comments

Comments
 (0)