summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2004-09-24 15:35:15 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2004-09-24 15:35:15 (GMT)
commit29302a7867f610c7162ec325ca9e23869b3e07a0 (patch)
tree3e277787af25bdda688b1de4bd769761a954ac84
parent739d49e39b8c9aeafc7c4ca45e7046788126507d (diff)
downloadcpython-29302a7867f610c7162ec325ca9e23869b3e07a0.zip
cpython-29302a7867f610c7162ec325ca9e23869b3e07a0.tar.gz
cpython-29302a7867f610c7162ec325ca9e23869b3e07a0.tar.bz2
Add a few more tests for the buffer() object.
-rw-r--r--Lib/test/test_types.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 31466b7..d0d0635 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -245,6 +245,14 @@ if str(a * 0) != '':
raise TestFailed, 'repeated buffer zero times has wrong content'
if str(a + buffer('def')) != 'asdfdef':
raise TestFailed, 'concatenation of buffers yields wrong content'
+if str(buffer(a)) != 'asdf':
+ raise TestFailed, 'composing buffers failed'
+if str(buffer(a, 2)) != 'df':
+ raise TestFailed, 'specifying buffer offset failed'
+if str(buffer(a, 0, 2)) != 'as':
+ raise TestFailed, 'specifying buffer size failed'
+if str(buffer(a, 1, 2)) != 'sd':
+ raise TestFailed, 'specifying buffer offset and size failed'
try: a[1] = 'g'
except TypeError: pass