summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/decorator.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-03-12 22:47:44 +0000
committerDamien George <damien.p.george@gmail.com>2015-03-12 22:48:45 +0000
commitaf43565322f5c45a1a92df1afceff24c93021998 (patch)
tree0334982a350b9201b8e0b256dc7c04dff8b3ea77 /tests/basics/decorator.py
parent848dd0e7620b086f984fc6254afc8202d5448a77 (diff)
downloadmicropython-af43565322f5c45a1a92df1afceff24c93021998.tar.gz
micropython-af43565322f5c45a1a92df1afceff24c93021998.zip
tests: Add tests for things that are not already tested.
The aim here is to improve coverage of the code.
Diffstat (limited to 'tests/basics/decorator.py')
-rw-r--r--tests/basics/decorator.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/basics/decorator.py b/tests/basics/decorator.py
new file mode 100644
index 0000000000..deb341d709
--- /dev/null
+++ b/tests/basics/decorator.py
@@ -0,0 +1,24 @@
+# test decorators
+
+def dec(f):
+ print('dec')
+ return f
+
+def dec_arg(x):
+ print(x)
+ return lambda f:f
+
+# plain decorator
+@dec
+def f():
+ pass
+
+# decorator with arg
+@dec_arg('dec_arg')
+def g():
+ pass
+
+# decorator of class
+@dec
+class A:
+ pass