From d5f42c9daf12f11b2a7a2db17409331b6f2a484e Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 15 Aug 2016 10:46:35 +1000 Subject: [PATCH] tests/basics: Add more list tests to improve coverage testing. --- tests/basics/list1.py | 6 ++++++ tests/basics/list_mult.py | 6 ++++++ tests/basics/list_pop.py | 6 ++++++ 3 files changed, 18 insertions(+) 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)