diff options
author | Kristján Valur Jónsson <sweskman@gmail.com> | 2013-03-19 17:17:47 -0700 |
---|---|---|
committer | Kristján Valur Jónsson <sweskman@gmail.com> | 2013-03-19 17:17:47 -0700 |
commit | 9795ca44fbf6d94789ee7053b81ff18f008c41ea (patch) | |
tree | 0aa7878e2ea987a574f5d9ad4090c0a0f8f0437d /Lib/test/test_struct.py | |
parent | 1d108bc7148336f01d6df066ba1b27678c9bd1ca (diff) | |
download | cpython-git-9795ca44fbf6d94789ee7053b81ff18f008c41ea.tar.gz |
Issue #10212: Support new buffer interface for struct.unpack and
cStringIO
Diffstat (limited to 'Lib/test/test_struct.py')
-rw-r--r-- | Lib/test/test_struct.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index c8dc6f1704..f1b5d9a1cd 100644 --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -496,6 +496,17 @@ class StructTest(unittest.TestCase): self.test_unpack_from(cls=buffer) + def test_unpack_with_memoryview(self): + with check_py3k_warnings(("buffer.. not supported in 3.x", + DeprecationWarning)): + # SF bug 1563759: struct.unpack doesn't support buffer protocol objects + data1 = memoryview('\x12\x34\x56\x78') + for data in [data1,]: + value, = struct.unpack('>I', data) + self.assertEqual(value, 0x12345678) + + self.test_unpack_from(cls=memoryview) + def test_bool(self): class ExplodingBool(object): def __nonzero__(self): |