Skip to content

Commit 5bfab66

Browse files
committed
Add bytes * 0 singleton test
1 parent f118655 commit 5bfab66

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎Lib/test/test_bytes.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,6 +1438,13 @@ class SubBytes(bytes):
14381438
self.assertNotEqual(id(s), id(1 * s))
14391439
self.assertNotEqual(id(s), id(s * 2))
14401440

1441+
@support.cpython_only
1442+
def test_repeat_singleton(self):
1443+
for b in b'', b'x', b"abc":
1444+
for repeat in (0, -23):
1445+
self.assertIs(b * repeat, b'')
1446+
self.assertIs(self.type2test(b) * repeat, b'')
1447+
14411448

14421449
class ByteArrayTest(BaseBytesTest, unittest.TestCase):
14431450
type2test = bytearray

0 commit comments

Comments
 (0)