From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 17 Jul 2024 07:24:44 +0000 (+0200) Subject: [3.13] gh-121842: Improve coverage of `PyBytes_FromStringAndSize` (GH-121843) (#121893) X-Git-Tag: v3.13.0b4~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=96c524cef641d53f887321488b29d12c0ac21ac7;p=thirdparty%2FPython%2Fcpython.git [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 f6c7d8d79c4e17167af98f2e0cb4b1e55d7b5d3c) Co-authored-by: sobolevn --- diff --git a/Lib/test/test_capi/test_bytes.py b/Lib/test/test_capi/test_bytes.py index f14d5545c829..d5f047bcf182 100644 --- a/Lib/test/test_capi/test_bytes.py +++ b/Lib/test/test_capi/test_bytes.py @@ -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)