From: Neil Schemenauer Date: Fri, 24 Sep 2004 15:35:15 +0000 (+0000) Subject: Add a few more tests for the buffer() object. X-Git-Tag: v2.4b1~200 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29302a7867f610c7162ec325ca9e23869b3e07a0;p=python Add a few more tests for the buffer() object. --- diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index 31466b78a1..d0d06359af 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