summaryrefslogtreecommitdiff
path: root/Lib/test/test_array.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2000-09-16 22:31:29 +0000
committerTim Peters <tim.peters@gmail.com>2000-09-16 22:31:29 +0000
commit077a11dd00092fead641b9f2bd824790791512c7 (patch)
tree26892b795eeda9a1d414e3e1a2e02d7c1ca65d5c /Lib/test/test_array.py
parent64850efa39c7e0442718f599c27fade5c9282311 (diff)
downloadcpython-git-077a11dd00092fead641b9f2bd824790791512c7.tar.gz
arraymodule: Fix SF bug 113960.
reverse() didn't work at all due to bad arg check. Fixed that. Added Brad Chapman to ACKS file, as the proud new owner of two implicitly copyrighted lines of Python source code <wink>. Repaired buffer_info's total lack of arg-checking. Replaced memmove by memcpy in reverse() guts, as memmove is often slower and the memory areas are guaranteed disjoint. Replaced poke-and-hope unchecked decl of tmp buffer size by assert-checked larger tmp buffer. Got rid of inconsistent spaces before open paren in docstrings. Added reverse() sanity tests to test_array.py.
Diffstat (limited to 'Lib/test/test_array.py')
-rwxr-xr-xLib/test/test_array.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index d3fe7e9c2c..fb451a9132 100755
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -122,9 +122,14 @@ def testtype(type, example):
a.pop()
a.pop()
a.pop()
- a.pop()
+ x = a.pop()
+ if x != 'e':
+ raise TestFailed, "array(%s) pop-test" % `type`
if a != array.array(type, "acd"):
raise TestFailed, "array(%s) pop-test" % `type`
+ a.reverse()
+ if a != array.array(type, "dca"):
+ raise TestFailed, "array(%s) reverse-test" % `type`
else:
a = array.array(type, [1, 2, 3, 4, 5])
a[:-1] = a
@@ -155,9 +160,14 @@ def testtype(type, example):
a.pop()
a.pop()
a.pop()
- a.pop()
+ x = a.pop()
+ if x != 5:
+ raise TestFailed, "array(%s) pop-test" % `type`
if a != array.array(type, [1, 3, 4]):
raise TestFailed, "array(%s) pop-test" % `type`
+ a.reverse()
+ if a != array.array(type, [4, 3, 1]):
+ raise TestFailed, "array(%s) reverse-test" % `type`
# test that overflow exceptions are raised as expected for assignment
# to array of specific integral types