From f0691f4ed58cab324dee151886ec13cecc1b6771 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 5 Jan 2014 13:44:06 +0000 Subject: Fix qstr in objlist.c; add more tests for list.index. list.index fails on an edge case. --- tests/basics/tests/list_index.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/basics/tests/list_index.py b/tests/basics/tests/list_index.py index cc853fe0e..f28263fba 100644 --- a/tests/basics/tests/list_index.py +++ b/tests/basics/tests/list_index.py @@ -1,12 +1,24 @@ a = [1, 2, 3] +print(a.index(1)) +print(a.index(2)) +print(a.index(3)) +print(a.index(3, 2)) +try: + print(a.index(3, 2, 2)) +except ValueError: + print("Raised ValueError") +else: + print("Did not raise ValueError") + a = a + a b = [0, 0, a] print(a.index(2)) print(b.index(a)) print(a.index(2, 2)) + try: a.index(2, 2, 2) except ValueError: print("Raised ValueError") else: - raise AssertionError("Did not raise ValueError") + print("Did not raise ValueError") -- cgit v1.2.3