tests/basics: Add more list tests to improve coverage testing.

This commit is contained in:
Damien George 2016-08-15 10:46:35 +10:00
parent 3c82d1d34b
commit d5f42c9daf
3 changed files with 18 additions and 0 deletions

View File

@ -22,3 +22,9 @@ print(x)
print(x[1:]) print(x[1:])
print(x[:-1]) print(x[:-1])
print(x[2:3]) print(x[2:3])
# unsupported type on RHS of add
try:
[] + None
except TypeError:
print('TypeError')

View File

@ -10,3 +10,9 @@ for i in (-4, -2, 0, 2, 4):
a = [1, 2, 3] a = [1, 2, 3]
c = a * 3 c = a * 3
print(a, c) print(a, c)
# unsupported type on RHS
try:
[] * None
except TypeError:
print('TypeError')

View File

@ -9,3 +9,9 @@ except IndexError:
print("IndexError raised") print("IndexError raised")
else: else:
raise AssertionError("No IndexError raised") 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)