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

Peter Schneider-Kamp python-dev@python.org
Mon, 31 Jul 2000 13:50:00 -0700


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

Modified Files:
	test_array.py 
Log Message:

added count, extend, index, pop and remove to arraymodule



Index: test_array.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_array.py	2000/06/28 17:50:51	1.7
--- test_array.py	2000/07/31 20:49:58	1.8
***************
*** 106,109 ****
--- 106,129 ----
              if a != array.array(type, "aabcdee"):
                  raise TestFailed, "array(%s) self-slice-assign (cntr)" % `type`
+             if a.index("e") != 5:
+             	raise TestFailed, "array(%s) index-test" % `type`
+             if a.count("a") != 2:
+             	raise TestFailed, "array(%s) count-test" % `type`
+             a.remove("e")
+             if a != array.array(type, "aabcde"):
+             	raise TestFailed, "array(%s) remove-test" % `type`
+             if a.pop(0) != "a":
+             	raise TestFailed, "array(%s) pop-test" % `type`
+             if a.pop(1) != "b":
+             	raise TestFailed, "array(%s) pop-test" % `type`
+             a.extend(array.array(type, "xyz"))
+             if a != array.array(type, "acdexyz"):
+                 raise TestFailed, "array(%s) extend-test" % `type`
+             a.pop()
+             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])
***************
*** 119,122 ****
--- 139,162 ----
              if a != array.array(type, [1, 1, 2, 3, 4, 5, 5]):
                  raise TestFailed, "array(%s) self-slice-assign (cntr)" % `type`
+             if a.index(5) != 5:
+             	raise TestFailed, "array(%s) index-test" % `type`
+             if a.count(1) != 2:
+             	raise TestFailed, "array(%s) count-test" % `type`
+             a.remove(5)
+             if a != array.array(type, [1, 1, 2, 3, 4, 5]):
+             	raise TestFailed, "array(%s) remove-test" % `type`
+             if a.pop(0) != 1:
+             	raise TestFailed, "array(%s) pop-test" % `type`
+             if a.pop(1) != 2:
+             	raise TestFailed, "array(%s) pop-test" % `type`
+             a.extend(array.array(type, [7, 8, 9]))
+             if a != array.array(type, [1, 3, 4, 5, 7, 8, 9]):
+                 raise TestFailed, "array(%s) extend-test" % `type`
+             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