Skip to content

Commit

Permalink
tests/basics: Add more tuple tests to improve coverage testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgeorge committed Aug 15, 2016
1 parent 2196799 commit 3c82d1d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/basics/builtin_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
print(hash(False))
print(hash(True))
print({():1}) # hash tuple
print({(1,):1}) # hash non-empty tuple
print({1 << 66:1}) # hash big int
print({-(1 << 66):2}) # hash negative big int
print(hash in {hash:1}) # hash function
Expand Down
15 changes: 15 additions & 0 deletions tests/basics/tuple1.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,18 @@
print(x[2:3])

print(x + (10, 100, 10000))

# 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')
6 changes: 6 additions & 0 deletions tests/basics/tuple_mult.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@
a = (1, 2, 3)
c = a * 3
print(a, c)

# unsupported type on RHS
try:
() * None
except TypeError:
print('TypeError')

0 comments on commit 3c82d1d

Please sign in to comment.