micropython: add micropython component
This commit is contained in:
17
components/language/micropython/tests/basics/list_pop.py
Normal file
17
components/language/micropython/tests/basics/list_pop.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# list poppin'
|
||||
a = [1, 2, 3]
|
||||
print(a.pop())
|
||||
print(a.pop())
|
||||
print(a.pop())
|
||||
try:
|
||||
print(a.pop())
|
||||
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)
|
Reference in New Issue
Block a user