[Python-checkins] CVS: python/dist/src/Lib/test test_array.py,1.8,1.9

Tim Peters python-dev@python.org
Sat, 16 Sep 2000 15:31:31 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv26393/python/dist/src/Lib/test

Modified Files:
	test_array.py 
Log Message:
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.


Index: test_array.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** test_array.py	2000/07/31 20:49:58	1.8
--- test_array.py	2000/09/16 22:31:28	1.9
***************
*** 123,129 ****
              a.pop()
              a.pop()
!             a.pop()
              if a != array.array(type, "acd"):
              	raise TestFailed, "array(%s) pop-test" % `type`
          else:
              a = array.array(type, [1, 2, 3, 4, 5])
--- 123,134 ----
              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])
***************
*** 155,162 ****
              a.pop()
              a.pop()
-             a.pop()
              a.pop()
              if a != array.array(type, [1, 3, 4]):
              	raise TestFailed, "array(%s) pop-test" % `type`
  
          # test that overflow exceptions are raised as expected for assignment
--- 160,172 ----
              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