[3.13] gh-121842: Improve coverage of `PyBytes_FromStringAndSize` (GH-121843) (#121893)

gh-121842: Improve coverage of `PyBytes_FromStringAndSize` (GH-121843)
(cherry picked from commit f6c7d8d79c)

Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2024-07-17 09:24:44 +02:00 committed by GitHub
parent 659725c6ac
commit 96c524cef6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -53,6 +53,8 @@ class CAPITest(unittest.TestCase):
self.assertEqual(fromstringandsize(b'abc'), b'abc')
self.assertEqual(fromstringandsize(b'abc', 2), b'ab')
self.assertEqual(fromstringandsize(b'abc\0def'), b'abc\0def')
self.assertEqual(fromstringandsize(b'a'), b'a')
self.assertEqual(fromstringandsize(b'a', 1), b'a')
self.assertEqual(fromstringandsize(b'', 0), b'')
self.assertEqual(fromstringandsize(NULL, 0), b'')
self.assertEqual(len(fromstringandsize(NULL, 3)), 3)