You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
560 B
34 lines
560 B
4 years ago
|
# basic tuple functionality
|
||
|
x = (1, 2, 3 * 4)
|
||
|
print(x)
|
||
|
try:
|
||
|
x[0] = 4
|
||
|
except TypeError:
|
||
|
print("TypeError")
|
||
|
print(x)
|
||
|
try:
|
||
|
x.append(5)
|
||
|
except AttributeError:
|
||
|
print("AttributeError")
|
||
|
|
||
|
print(x + (10, 100, 10000))
|
||
|
|
||
|
# inplace add operator
|
||
|
x += (10, 11, 12)
|
||
|
print(x)
|
||
|
|
||
|
# construction of tuple from large iterator (tests implementation detail of uPy)
|
||
|
print(tuple(range(20)))
|
||
|
|
||
|
# unsupported unary operation
|
||
|
try:
|
||
|
+()
|
||
|
except TypeError:
|
||
|
print('TypeError')
|
||
|
|
||
|
# unsupported type on RHS of add
|
||
|
try:
|
||
|
() + None
|
||
|
except TypeError:
|
||
|
print('TypeError')
|