Add a few more tests for the buffer() object.

This commit is contained in:
Neil Schemenauer 2004-09-24 15:35:15 +00:00
parent 739d49e39b
commit 29302a7867
1 changed files with 8 additions and 0 deletions

View File

@ -245,6 +245,14 @@ if str(a * 0) != '':
raise TestFailed, 'repeated buffer zero times has wrong content' raise TestFailed, 'repeated buffer zero times has wrong content'
if str(a + buffer('def')) != 'asdfdef': if str(a + buffer('def')) != 'asdfdef':
raise TestFailed, 'concatenation of buffers yields wrong content' 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' try: a[1] = 'g'
except TypeError: pass except TypeError: pass