diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-12-08 15:44:50 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-12-08 15:44:50 (GMT) |
commit | 5493d5ea2afec8a1ff3227e08e908c6e433638cc (patch) | |
tree | 86070bc851a043dd89168ff1b20419ea439bb648 /Lib/test/test_struct.py | |
parent | 337c50b8cb84155918ff0b4b5478c70f7a6f3faf (diff) | |
download | cpython-5493d5ea2afec8a1ff3227e08e908c6e433638cc.zip cpython-5493d5ea2afec8a1ff3227e08e908c6e433638cc.tar.gz cpython-5493d5ea2afec8a1ff3227e08e908c6e433638cc.tar.bz2 |
Issue #19099: The struct module now supports Unicode format strings.
Diffstat (limited to 'Lib/test/test_struct.py')
-rw-r--r-- | Lib/test/test_struct.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index 2e613f7..4811974 100644 --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -574,6 +574,18 @@ class StructTest(unittest.TestCase): self.check_sizeof('0s', 1) self.check_sizeof('0c', 0) + def test_unicode_format(self): + try: + unicode + except NameError: + self.skipTest('no unicode support') + # Issue #19099 + s = struct.Struct(unichr(ord('I'))) + self.assertEqual(s.format, 'I') + self.assertIs(type(s.format), str) + self.assertRaises(ValueError, struct.Struct, unichr(0x80)) + + def test_main(): support.run_unittest(StructTest) |