Skip to content

Commit 7b4b94b

Browse files
author
nascheme
committed
Add a few more tests for the buffer() object.
git-svn-id: http://svn.python.org/projects/python/trunk@37422 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent eec47c1 commit 7b4b94b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎Lib/test/test_types.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,14 @@ class C: pass
245245
raise TestFailed, 'repeated buffer zero times has wrong content'
246246
if str(a + buffer('def')) != 'asdfdef':
247247
raise TestFailed, 'concatenation of buffers yields wrong content'
248+
if str(buffer(a)) != 'asdf':
249+
raise TestFailed, 'composing buffers failed'
250+
if str(buffer(a, 2)) != 'df':
251+
raise TestFailed, 'specifying buffer offset failed'
252+
if str(buffer(a, 0, 2)) != 'as':
253+
raise TestFailed, 'specifying buffer size failed'
254+
if str(buffer(a, 1, 2)) != 'sd':
255+
raise TestFailed, 'specifying buffer offset and size failed'
248256

249257
try: a[1] = 'g'
250258
except TypeError: pass

0 commit comments

Comments
 (0)