summaryrefslogtreecommitdiff
path: root/Lib/test/test_buffer.py
diff options
context:
space:
mode:
authorKristján Valur Jónsson <sweskman@gmail.com>2013-03-19 16:50:51 -0700
committerKristján Valur Jónsson <sweskman@gmail.com>2013-03-19 16:50:51 -0700
commit1d108bc7148336f01d6df066ba1b27678c9bd1ca (patch)
tree74a30ae65b7215fe8d0350848f0258156bcf0e70 /Lib/test/test_buffer.py
parentacb6e85808ec2a4522c1e7cf665c85c02edf16ab (diff)
downloadcpython-git-1d108bc7148336f01d6df066ba1b27678c9bd1ca.tar.gz
Issue #10211 : Buffer object should support the new buffer interface.
Diffstat (limited to 'Lib/test/test_buffer.py')
-rw-r--r--Lib/test/test_buffer.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py
index 6bdc34d28e..ac8e636ba4 100644
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -21,6 +21,14 @@ class BufferTests(unittest.TestCase):
self.assertEqual(b[start:stop:step],
s[start:stop:step])
+ def test_newbuffer_interface(self):
+ # Test that the buffer object has the new buffer interface
+ # as used by the memoryview object
+ s = "".join(chr(c) for c in list(range(255, -1, -1)))
+ b = buffer(s)
+ m = memoryview(b) # Should not raise an exception
+ self.assertEqual(m.tobytes(), s)
+
def test_main():
with test_support.check_py3k_warnings(("buffer.. not supported",