Skip to content

Commit 3c82d1d

Browse files
committed
tests/basics: Add more tuple tests to improve coverage testing.
1 parent 2196799 commit 3c82d1d

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

tests/basics/builtin_hash.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
print(hash(False))
44
print(hash(True))
55
print({():1}) # hash tuple
6+
print({(1,):1}) # hash non-empty tuple
67
print({1 << 66:1}) # hash big int
78
print({-(1 << 66):2}) # hash negative big int
89
print(hash in {hash:1}) # hash function

tests/basics/tuple1.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,18 @@
1616
print(x[2:3])
1717

1818
print(x + (10, 100, 10000))
19+
20+
# construction of tuple from large iterator (tests implementation detail of uPy)
21+
print(tuple(range(20)))
22+
23+
# unsupported unary operation
24+
try:
25+
+()
26+
except TypeError:
27+
print('TypeError')
28+
29+
# unsupported type on RHS of add
30+
try:
31+
() + None
32+
except TypeError:
33+
print('TypeError')

tests/basics/tuple_mult.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@
1010
a = (1, 2, 3)
1111
c = a * 3
1212
print(a, c)
13+
14+
# unsupported type on RHS
15+
try:
16+
() * None
17+
except TypeError:
18+
print('TypeError')

0 commit comments

Comments
 (0)