diff options
| author | Thomas Wouters <thomas@python.org> | 2007-08-28 15:28:19 (GMT) |
|---|---|---|
| committer | Thomas Wouters <thomas@python.org> | 2007-08-28 15:28:19 (GMT) |
| commit | 3ccec68a05abae43cf74dc7821c61ba88ab6cb46 (patch) | |
| tree | 07e97200d168eec13110e16a11b974310b8b550a /Lib/test/list_tests.py | |
| parent | 0f4a14b56fcbd939e60f424517db61ca6f2f3885 (diff) | |
| download | cpython-3ccec68a05abae43cf74dc7821c61ba88ab6cb46.zip cpython-3ccec68a05abae43cf74dc7821c61ba88ab6cb46.tar.gz cpython-3ccec68a05abae43cf74dc7821c61ba88ab6cb46.tar.bz2 | |
Improve extended slicing support in builtin types and classes. Specifically:
- Specialcase extended slices that amount to a shallow copy the same way as
is done for simple slices, in the tuple, string and unicode case.
- Specialcase step-1 extended slices to optimize the common case for all
involved types.
- For lists, allow extended slice assignment of differing lengths as long
as the step is 1. (Previously, 'l[:2:1] = []' failed even though
'l[:2] = []' and 'l[:2:None] = []' do not.)
- Implement extended slicing for buffer, array, structseq, mmap and
UserString.UserString.
- Implement slice-object support (but not non-step-1 slice assignment) for
UserString.MutableString.
- Add tests for all new functionality.
Diffstat (limited to 'Lib/test/list_tests.py')
| -rw-r--r-- | Lib/test/list_tests.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py index 7c6623a..1c799d7 100644 --- a/Lib/test/list_tests.py +++ b/Lib/test/list_tests.py @@ -179,8 +179,10 @@ class CommonTest(seq_tests.CommonTest): self.assertEqual(a, self.type2test(range(10))) self.assertRaises(TypeError, a.__setslice__, 0, 1, 5) + self.assertRaises(TypeError, a.__setitem__, slice(0, 1, 5)) self.assertRaises(TypeError, a.__setslice__) + self.assertRaises(TypeError, a.__setitem__) def test_delslice(self): a = self.type2test([0, 1]) |
