diff options
-rw-r--r-- | Lib/test/test_types.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index d0d0635..2dd3b88 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -253,6 +253,17 @@ 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: buffer(buffer('asdf', 1), -1) +except ValueError: pass +else: raise TestFailed, "buffer(buffer('asdf', 1), -1) should raise ValueError" +if str(buffer(buffer('asdf', 0, 2), 0)) != 'as': + raise TestFailed, 'composing length-specified buffer failed' +if str(buffer(buffer('asdf', 0, 2), 0, 5000)) != 'as': + raise TestFailed, 'composing length-specified buffer failed' +if str(buffer(buffer('asdf', 0, 2), 0, -1)) != 'as': + raise TestFailed, 'composing length-specified buffer failed' +if str(buffer(buffer('asdf', 0, 2), 1, 2)) != 's': + raise TestFailed, 'composing length-specified buffer failed' try: a[1] = 'g' except TypeError: pass |