diff options
author | xbe <xbe@machine> | 2014-03-12 22:57:16 -0700 |
---|---|---|
committer | xbe <xbe@machine> | 2014-03-12 22:57:16 -0700 |
commit | 9e1e8cd6428e875eb29be98124ee3b1ba2bace30 (patch) | |
tree | be21ee15a324d83b28851395182d925d091b12ef /tests/basics/list_index.py | |
parent | 19438fd30a3184b656221a59062ea32453d0fd16 (diff) | |
download | micropython-9e1e8cd6428e875eb29be98124ee3b1ba2bace30.tar.gz micropython-9e1e8cd6428e875eb29be98124ee3b1ba2bace30.zip |
Implement str.count and add tests for it.
Also modify mp_get_index to accept:
1. Indices that are or evaluate to a boolean.
2. Slice indices.
Add tests for these two cases.
Diffstat (limited to 'tests/basics/list_index.py')
-rw-r--r-- | tests/basics/list_index.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/basics/list_index.py b/tests/basics/list_index.py index f28263fba6..a669e69c49 100644 --- a/tests/basics/list_index.py +++ b/tests/basics/list_index.py @@ -3,6 +3,16 @@ print(a.index(1)) print(a.index(2)) print(a.index(3)) print(a.index(3, 2)) +print(a.index(1, -100)) +print(a.index(1, False)) + +try: + print(a.index(1, True)) +except ValueError: + print("Raised ValueError") +else: + print("Did not raise ValueError") + try: print(a.index(3, 2, 2)) except ValueError: |