gh-107406: Add better struct.Struct repr (#107407)

This commit is contained in:
denballakh 2023-08-26 14:54:16 +05:00 committed by GitHub
parent 8ba4714611
commit e407cea193
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 0 deletions

View file

@ -774,6 +774,10 @@ class StructTest(unittest.TestCase):
test_error_propagation('N')
test_error_propagation('n')
def test_repr(self):
s = struct.Struct('=i2H')
self.assertEqual(repr(s), f'Struct({s.format!r})')
class UnpackIteratorTest(unittest.TestCase):
"""
Tests for iterative unpacking (struct.Struct.iter_unpack).