summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_struct.py
diff options
context:
space:
mode:
authordenballakh <47365157+denballakh@users.noreply.github.com>2023-08-26 09:54:16 (GMT)
committerGitHub <noreply@github.com>2023-08-26 09:54:16 (GMT)
commite407cea1938b80b1d469f148a4ea65587820e3eb (patch)
tree21b9df69dbdb5ffff761f94107c10a8f59ea6768 /Lib/test/test_struct.py
parent8ba47146111d714c7b61825d43b52311d9be366d (diff)
downloadcpython-e407cea1938b80b1d469f148a4ea65587820e3eb.zip
cpython-e407cea1938b80b1d469f148a4ea65587820e3eb.tar.gz
cpython-e407cea1938b80b1d469f148a4ea65587820e3eb.tar.bz2
gh-107406: Add better `struct.Struct` repr (#107407)
Diffstat (limited to 'Lib/test/test_struct.py')
-rw-r--r--Lib/test/test_struct.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index 6b1f22f..c76649c 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -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).