]> granicus.if.org Git - python/commitdiff
Buffer-object repitition and concatenation has worked all along; add a test
authorFred Drake <fdrake@acm.org>
Thu, 2 May 2002 04:27:20 +0000 (04:27 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 2 May 2002 04:27:20 +0000 (04:27 +0000)
to make avoid regression.

Lib/test/test_types.py

index fc30e5b6b85add75fd40df31098f2f8f4a7c7bba..bc13c5f557d155d6a9faafca5420f35a4445e4a3 100644 (file)
@@ -522,6 +522,12 @@ hash(a)
 b = a * 5
 if a == b:
     raise TestFailed, 'buffers should not be equal'
+if str(b) != ('asdf' * 5):
+    raise TestFailed, 'repeated buffer has wrong content'
+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'
 
 try: a[1] = 'g'
 except TypeError: pass