From affd77f71e7f24aa7a376ca6c6724581deb1b6cd Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 16 Jul 1998 15:29:06 +0000 Subject: Add tests for list self-assigns. (Sorry, this should have been here before JPython 1.0 came out.) --- Lib/test/test_types.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index 685c05b..072e6d2 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -134,6 +134,19 @@ if 0*[1,2,3] <> []: raise TestFailed, 'list repetition 0*' if min([1,2]) <> 1 or max([1,2]) <> 2: raise TestFailed, 'min/max list' if 0 in [0,1,2] and 1 in [0,1,2] and 2 in [0,1,2] and 3 not in [0,1,2]: pass else: raise TestFailed, 'in/not in list' +a = [1, 2, 3, 4, 5] +a[:-1] = a +if a != [1, 2, 3, 4, 5, 5]: + raise TestFailed, "list self-slice-assign (head)" +a = [1, 2, 3, 4, 5] +a[1:] = a +if a != [1, 1, 2, 3, 4, 5]: + raise TestFailed, "list self-slice-assign (tail)" +a = [1, 2, 3, 4, 5] +a[1:-1] = a +if a != [1, 1, 2, 3, 4, 5, 5]: + raise TestFailed, "list self-slice-assign (center)" + print '6.5.3a Additional list operations' a = [0,1,2,3,4] -- cgit v0.12