summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/true-value.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-01-19 17:41:01 +0000
committerDamien George <damien.p.george@gmail.com>2014-01-19 17:41:01 +0000
commit5f7e8dc176661b49e12a0d8425101799ff176d19 (patch)
tree0fd3daa844300d62a3836b5bb16c3c7be2b875cb /tests/basics/true-value.py
parentb2ebb161d494864cdbee05ee8b74a775845e238e (diff)
parentdb796ef84d1737edc4ee44f1b53ff0c1fddb349c (diff)
downloadmicropython-5f7e8dc176661b49e12a0d8425101799ff176d19.tar.gz
micropython-5f7e8dc176661b49e12a0d8425101799ff176d19.zip
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'tests/basics/true-value.py')
-rw-r--r--tests/basics/true-value.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/basics/true-value.py b/tests/basics/true-value.py
new file mode 100644
index 0000000000..6ba410ddc2
--- /dev/null
+++ b/tests/basics/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")