diff options
author | Damien George <damien.p.george@gmail.com> | 2016-08-15 10:46:35 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-08-15 10:46:35 +1000 |
commit | d5f42c9daf12f11b2a7a2db17409331b6f2a484e (patch) | |
tree | c2f57591e75e86918ad85e8d046d35ee0aaaeb1f | |
parent | 3c82d1d34b6450e73816e206fa5a5d3330a4df48 (diff) | |
download | micropython-d5f42c9daf12f11b2a7a2db17409331b6f2a484e.tar.gz micropython-d5f42c9daf12f11b2a7a2db17409331b6f2a484e.zip |
tests/basics: Add more list tests to improve coverage testing.
-rw-r--r-- | tests/basics/list1.py | 6 | ||||
-rw-r--r-- | tests/basics/list_mult.py | 6 | ||||
-rw-r--r-- | tests/basics/list_pop.py | 6 |
3 files changed, 18 insertions, 0 deletions
diff --git a/tests/basics/list1.py b/tests/basics/list1.py index c8317baa3d..fa426c0e58 100644 --- a/tests/basics/list1.py +++ b/tests/basics/list1.py @@ -22,3 +22,9 @@ print(x) print(x[1:]) print(x[:-1]) print(x[2:3]) + +# unsupported type on RHS of add +try: + [] + None +except TypeError: + print('TypeError') diff --git a/tests/basics/list_mult.py b/tests/basics/list_mult.py index 16948f74c2..548f88534e 100644 --- a/tests/basics/list_mult.py +++ b/tests/basics/list_mult.py @@ -10,3 +10,9 @@ for i in (-4, -2, 0, 2, 4): a = [1, 2, 3] c = a * 3 print(a, c) + +# unsupported type on RHS +try: + [] * None +except TypeError: + print('TypeError') diff --git a/tests/basics/list_pop.py b/tests/basics/list_pop.py index bb2ccc6d67..87ed456f85 100644 --- a/tests/basics/list_pop.py +++ b/tests/basics/list_pop.py @@ -9,3 +9,9 @@ except IndexError: print("IndexError raised") else: raise AssertionError("No IndexError raised") + +# popping such that list storage shrinks (tests implementation detail of uPy) +l = list(range(20)) +for i in range(len(l)): + l.pop() +print(l) |