diff options
author | Damien George <damien.p.george@gmail.com> | 2014-02-10 21:41:14 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-02-10 21:41:14 +0000 |
commit | 8c2b333affea7445c457c5247df047947bed9b53 (patch) | |
tree | b697957a499162ccca3219dca426b1bcd35cd0c7 /tests/basics/tuple_index.py | |
parent | 7d0bfbedd218fadd91e2bbeb6486371ffeb7b682 (diff) | |
parent | 2e24ee8d80de20e879275c087ecc1ca9b4d27297 (diff) | |
download | micropython-8c2b333affea7445c457c5247df047947bed9b53.tar.gz micropython-8c2b333affea7445c457c5247df047947bed9b53.zip |
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'tests/basics/tuple_index.py')
-rw-r--r-- | tests/basics/tuple_index.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/basics/tuple_index.py b/tests/basics/tuple_index.py new file mode 100644 index 0000000000..1aef100d78 --- /dev/null +++ b/tests/basics/tuple_index.py @@ -0,0 +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: + print("Did not raise ValueError") |