summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-08-15 10:46:02 +1000
committerDamien George <damien.p.george@gmail.com>2016-08-15 10:46:02 +1000
commit3c82d1d34b6450e73816e206fa5a5d3330a4df48 (patch)
treeab48bc9b91cfc4f8c2d9d653580b89a0ab294670 /tests
parent21967990519b3d0778770ddb0994216d012101c3 (diff)
downloadmicropython-3c82d1d34b6450e73816e206fa5a5d3330a4df48.tar.gz
micropython-3c82d1d34b6450e73816e206fa5a5d3330a4df48.zip
tests/basics: Add more tuple tests to improve coverage testing.
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/builtin_hash.py1
-rw-r--r--tests/basics/tuple1.py15
-rw-r--r--tests/basics/tuple_mult.py6
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/basics/builtin_hash.py b/tests/basics/builtin_hash.py
index c9731a3b59..ffea08e575 100644
--- a/tests/basics/builtin_hash.py
+++ b/tests/basics/builtin_hash.py
@@ -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
diff --git a/tests/basics/tuple1.py b/tests/basics/tuple1.py
index 53eac2a306..2993391d53 100644
--- a/tests/basics/tuple1.py
+++ b/tests/basics/tuple1.py
@@ -16,3 +16,18 @@ print(x[:-1])
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')
diff --git a/tests/basics/tuple_mult.py b/tests/basics/tuple_mult.py
index 0f52bce44e..b128b29689 100644
--- a/tests/basics/tuple_mult.py
+++ b/tests/basics/tuple_mult.py
@@ -10,3 +10,9 @@ for i in (-4, -2, 0, 2, 4):
a = (1, 2, 3)
c = a * 3
print(a, c)
+
+# unsupported type on RHS
+try:
+ () * None
+except TypeError:
+ print('TypeError')