summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2008-03-17 20:50:44 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2008-03-17 20:50:44 (GMT)
commit953e4e52c4fb63e501bcbaa97db857de9c159cf5 (patch)
tree7797b57a96d3748ce1188e599b86b20c2ef45fe9
parent425136be01b53b0d148d99bc8995eeb48e3c4d3a (diff)
downloadcpython-953e4e52c4fb63e501bcbaa97db857de9c159cf5.zip
cpython-953e4e52c4fb63e501bcbaa97db857de9c159cf5.tar.gz
cpython-953e4e52c4fb63e501bcbaa97db857de9c159cf5.tar.bz2
Whoops, I missed a few more places that were using slicing from the operator module
-rw-r--r--Lib/ctypes/test/test_arrays.py5
-rw-r--r--Lib/ctypes/test/test_slicing.py10
-rw-r--r--Lib/test/test_operator.py26
3 files changed, 2 insertions, 39 deletions
diff --git a/Lib/ctypes/test/test_arrays.py b/Lib/ctypes/test/test_arrays.py
index 142bae8..8b5476d 100644
--- a/Lib/ctypes/test/test_arrays.py
+++ b/Lib/ctypes/test/test_arrays.py
@@ -57,11 +57,8 @@ class ArrayTestCase(unittest.TestCase):
self.failUnlessEqual(len(ca), 3)
- # slicing is now supported, but not extended slicing (3-argument)!
- from operator import getslice, delitem
- self.assertRaises(TypeError, getslice, ca, 0, 1, -1)
-
# cannot delete items
+ from operator import delitem
self.assertRaises(TypeError, delitem, ca, 0)
def test_numeric_arrays(self):
diff --git a/Lib/ctypes/test/test_slicing.py b/Lib/ctypes/test/test_slicing.py
index 4974302..7c863c1 100644
--- a/Lib/ctypes/test/test_slicing.py
+++ b/Lib/ctypes/test/test_slicing.py
@@ -45,21 +45,17 @@ class SlicesTestCase(unittest.TestCase):
b[33::-3] = range(12)
self.failUnlessEqual(a[:], b)
- from operator import setslice, setitem
+ from operator import setitem
# TypeError: int expected instead of str instance
- self.assertRaises(TypeError, setslice, a, 0, 5, "abcde")
self.assertRaises(TypeError, setitem, a, slice(0, 5), "abcde")
# TypeError: int expected instead of str instance
- self.assertRaises(TypeError, setslice, a, 0, 5, ["a", "b", "c", "d", "e"])
self.assertRaises(TypeError, setitem, a, slice(0, 5),
["a", "b", "c", "d", "e"])
# TypeError: int expected instead of float instance
- self.assertRaises(TypeError, setslice, a, 0, 5, [1, 2, 3, 4, 3.14])
self.assertRaises(TypeError, setitem, a, slice(0, 5),
[1, 2, 3, 4, 3.14])
# ValueError: Can only assign sequence of same size
- self.assertRaises(ValueError, setslice, a, 0, 5, range(32))
self.assertRaises(ValueError, setitem, a, slice(0, 5), range(32))
def test_char_ptr(self):
@@ -86,8 +82,6 @@ class SlicesTestCase(unittest.TestCase):
self.assertRaises(ValueError, operator.getitem,
res, slice(-5, None, None))
- self.assertRaises(TypeError, operator.setslice,
- res, 0, 5, "abcde")
self.assertRaises(TypeError, operator.setitem,
res, slice(0, 5), "abcde")
dll.my_free(res)
@@ -150,8 +144,6 @@ class SlicesTestCase(unittest.TestCase):
self.failUnlessEqual(res[len(s)-1:5:-7], s[:5:-7])
import operator
- self.assertRaises(TypeError, operator.setslice,
- res, 0, 5, "abcde")
self.assertRaises(TypeError, operator.setitem,
res, slice(0, 5), "abcde")
dll.my_free(res)
diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py
index 84b821e..d6146ee 100644
--- a/Lib/test/test_operator.py
+++ b/Lib/test/test_operator.py
@@ -137,15 +137,6 @@ class OperatorTestCase(unittest.TestCase):
self.failUnless(operator.delitem(a, 1) is None)
self.assert_(a == [4, 2, 1])
- def test_delslice(self):
- a = list(range(10))
- self.failUnlessRaises(TypeError, operator.delslice, a)
- self.failUnlessRaises(TypeError, operator.delslice, a, None, None)
- self.failUnless(operator.delslice(a, 2, 8) is None)
- self.assert_(a == [0, 1, 8, 9])
- operator.delslice(a, 0, test_support.MAX_Py_ssize_t)
- self.assertEqual(a, [])
-
def test_floordiv(self):
self.failUnlessRaises(TypeError, operator.floordiv, 5)
self.failUnlessRaises(TypeError, operator.floordiv, None, None)
@@ -162,14 +153,6 @@ class OperatorTestCase(unittest.TestCase):
self.failUnlessRaises(TypeError, operator.getitem, a, None)
self.failUnless(operator.getitem(a, 2) == 2)
- def test_getslice(self):
- a = list(range(10))
- self.failUnlessRaises(TypeError, operator.getslice)
- self.failUnlessRaises(TypeError, operator.getslice, a, None, None)
- self.failUnless(operator.getslice(a, 4, 6) == [4, 5])
- b = operator.getslice(a, 0, test_support.MAX_Py_ssize_t)
- self.assertEqual(b, a)
-
def test_indexOf(self):
self.failUnlessRaises(TypeError, operator.indexOf)
self.failUnlessRaises(TypeError, operator.indexOf, None, None)
@@ -298,15 +281,6 @@ class OperatorTestCase(unittest.TestCase):
self.assert_(a == [2, 1, 2])
self.assertRaises(IndexError, operator.setitem, a, 4, 2)
- def test_setslice(self):
- a = list(range(4))
- self.failUnlessRaises(TypeError, operator.setslice, a)
- self.failUnlessRaises(TypeError, operator.setslice, a, None, None, None)
- self.failUnless(operator.setslice(a, 1, 3, [2, 1]) is None)
- self.assert_(a == [0, 2, 1, 3])
- operator.setslice(a, 0, test_support.MAX_Py_ssize_t, [])
- self.assertEqual(a, [])
-
def test_sub(self):
self.failUnlessRaises(TypeError, operator.sub)
self.failUnlessRaises(TypeError, operator.sub, None, None)