summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bytes.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-01-12 07:22:29 (GMT)
committerGitHub <noreply@github.com>2019-01-12 07:22:29 (GMT)
commit44cc4822bb3799858201e61294c5863f93ec12e2 (patch)
treef7d25e8a7403e81d86893c8a2f7f5402297bd903 /Lib/test/test_bytes.py
parentd0d3e99120b19a4b800f0f381b2807c93aeecf0e (diff)
downloadcpython-44cc4822bb3799858201e61294c5863f93ec12e2.zip
cpython-44cc4822bb3799858201e61294c5863f93ec12e2.tar.gz
cpython-44cc4822bb3799858201e61294c5863f93ec12e2.tar.bz2
bpo-33817: Fix _PyBytes_Resize() for empty bytes object. (GH-11516)
Add also tests for PyUnicode_FromFormat() and PyBytes_FromFormat() with empty result.
Diffstat (limited to 'Lib/test/test_bytes.py')
-rw-r--r--Lib/test/test_bytes.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index cc43321..f7454d9 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -1001,6 +1001,12 @@ class BytesTest(BaseBytesTest, unittest.TestCase):
self.assertRaises(OverflowError,
PyBytes_FromFormat, b'%c', c_int(256))
+ # Issue #33817: empty strings
+ self.assertEqual(PyBytes_FromFormat(b''),
+ b'')
+ self.assertEqual(PyBytes_FromFormat(b'%s', b''),
+ b'')
+
def test_bytes_blocking(self):
class IterationBlocked(list):
__bytes__ = None