mirror of
https://github.com/python/cpython.git
synced 2025-10-31 21:51:50 +00:00
gh-71679: Share the repr implementation between bytes and bytearray (GH-138181)
This allows to use the smart quotes algorithm in the bytearray's repr.
This commit is contained in:
parent
cf9ef73121
commit
a1cf6e92b6
5 changed files with 30 additions and 93 deletions
|
|
@ -1979,7 +1979,7 @@ def test_bytearray_repr(self, f=repr):
|
|||
self.assertEqual(f(bytearray([7, 8, 9, 10, 11, 12, 13])),
|
||||
r"bytearray(b'\x07\x08\t\n\x0b\x0c\r')")
|
||||
self.assertEqual(f(bytearray(b'"')), """bytearray(b'"')""") # '"'
|
||||
self.assertEqual(f(bytearray(b"'")), r'''bytearray(b"\'")''') # "\'"
|
||||
self.assertEqual(f(bytearray(b"'")), '''bytearray(b"'")''') # "'"
|
||||
self.assertEqual(f(bytearray(b"'\"")), r"""bytearray(b'\'"')""") # '\'"'
|
||||
self.assertEqual(f(bytearray(b"\"'\"")), r"""bytearray(b'"\'"')""") # '"\'"'
|
||||
self.assertEqual(f(bytearray(b'\'"\'')), r"""bytearray(b'\'"\'')""") # '\'"\''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue