summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-11-26 16:15:31 +1100
committerDamien George <damien.p.george@gmail.com>2016-11-26 16:15:31 +1100
commita4f96c8c2aaddc457a744eda6aaf5cdfb614bc6c (patch)
tree748ec9fbf0ba7a3f1d732ae1184851192e49dbac
parenta31a3a9fd5f9f26bc9e06b7c682a9544f71806ad (diff)
downloadmicropython-a4f96c8c2aaddc457a744eda6aaf5cdfb614bc6c.tar.gz
micropython-a4f96c8c2aaddc457a744eda6aaf5cdfb614bc6c.zip
tests/basics: Add tests for if-expressions.
-rw-r--r--tests/basics/ifexpr.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/basics/ifexpr.py b/tests/basics/ifexpr.py
new file mode 100644
index 0000000000..66f94f95c1
--- /dev/null
+++ b/tests/basics/ifexpr.py
@@ -0,0 +1,9 @@
+# test if-expressions
+
+print(1 if 0 else 2)
+print(3 if 1 else 4)
+
+def f(x):
+ print('a' if x else 'b')
+f([])
+f([1])