summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorMichele Simionato <michele.simionato@gmail.com>2013-11-24 07:07:16 +0100
committerMichele Simionato <michele.simionato@gmail.com>2013-11-24 07:07:16 +0100
commit6faf8468c33457ce2e7f215bfc54c66b467ef899 (patch)
treec266bcfc94f13a841215722ddb27d95eef95e681 /test.py
parent5448efa8c45ce70f8450a3001acc64be090029c5 (diff)
parent3e2bd43069fa1837d77f8ab2079044a44aaedd66 (diff)
downloadpython-decorator-git-6faf8468c33457ce2e7f215bfc54c66b467ef899.tar.gz
Merge branch 'devel'
Diffstat (limited to 'test.py')
-rw-r--r--test.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/test.py b/test.py
new file mode 100644
index 0000000..460c36a
--- /dev/null
+++ b/test.py
@@ -0,0 +1,34 @@
+"""
+Some simple tests
+"""
+
+import os
+from decorator import decorator
+
+@decorator
+def identity(f, *a, **k):
+ "do nothing decorator"
+ return f(*a, **k)
+
+@identity
+def f1():
+ "f1"
+
+def getfname(func):
+ fname = os.path.basename(func.__globals__['__file__'])
+ return os.path.splitext(fname)[0] + '.py'
+
+def test0():
+ this = getfname(identity)
+ assert this == 'test.py', this
+ print(identity.__doc__)
+
+def test1():
+ this = getfname(f1)
+ assert this == 'test.py', this
+ print(f1.__doc__)
+
+if __name__ == '__main__':
+ for name, test in list(globals().items()):
+ if name.startswith('test'):
+ test()