mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-21071: struct.Struct.format type is now str (#845)
This commit is contained in:
parent
a4b091e135
commit
f87b85f808
5 changed files with 19 additions and 2 deletions
|
@ -618,6 +618,14 @@ class StructTest(unittest.TestCase):
|
|||
# Shouldn't crash.
|
||||
self.assertEqual(struct.unpack(b'b', b'a'), (b'a'[0],))
|
||||
|
||||
def test_format_attr(self):
|
||||
s = struct.Struct('=i2H')
|
||||
self.assertEqual(s.format, '=i2H')
|
||||
|
||||
# use a bytes string
|
||||
s2 = struct.Struct(s.format.encode())
|
||||
self.assertEqual(s2.format, s.format)
|
||||
|
||||
|
||||
class UnpackIteratorTest(unittest.TestCase):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue