aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDamien George2014-01-16 22:09:54 +0000
committerDamien George2014-01-16 22:09:54 +0000
commit5a877503d992de4c7e533fb1616d36ab2e6433e8 (patch)
treea260c4fda0118b5ce27f9c774c6ffdd3d8482a7f /tests
parent8161a10de1011f2e8cf4e4b0c89b7a25db1631a0 (diff)
parent10744dd816b7cc2bfa6a7ea8402ae21aac12838b (diff)
Merge branch 'master' of github.com:dpgeorge/micropython
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/tests/true-value.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/basics/tests/true-value.py b/tests/basics/tests/true-value.py
new file mode 100644
index 000000000..6ba410ddc
--- /dev/null
+++ b/tests/basics/tests/true-value.py
@@ -0,0 +1,27 @@
+# Test true-ish value handling
+
+if not False:
+ print("False")
+
+if not 0:
+ print("0")
+
+if not "":
+ print("Empty string")
+if "foo":
+ print("Non-empty string")
+
+if not ():
+ print("Empty tuple")
+if ("",):
+ print("Non-empty tuple")
+
+if not []:
+ print("Empty list")
+if [0]:
+ print("Non-empty list")
+
+if not {}:
+ print("Empty dict")
+if {0:0}:
+ print("Non-empty dict")