summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorMichele Simionato <michele.simionato@gmail.com>2010-11-28 09:39:29 +0100
committerMichele Simionato <michele.simionato@gmail.com>2010-11-28 09:39:29 +0100
commitbbe48a4473a806342f3c22a192af3a8d62c81fad (patch)
tree148603758b140954c3787c1bdcba1df0fefe56e0 /test.py
parentd5fe6439400b04265d471c5d4a526f103cd78fc2 (diff)
downloadpython-decorator-git-bbe48a4473a806342f3c22a192af3a8d62c81fad.tar.gz
Fixed func_globals in the decorated function (release 3.2.1)
Diffstat (limited to 'test.py')
-rw-r--r--test.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test.py b/test.py
new file mode 100644
index 0000000..b21fe4d
--- /dev/null
+++ b/test.py
@@ -0,0 +1,24 @@
+"""
+Some simple tests executable with nose or py.test
+"""
+
+import os
+from decorator import decorator
+
+@decorator
+def identity(f, *a, **k):
+ "do nothing decorator"
+ return f(*a, **k)
+
+@identity
+def f1():
+ "f1"
+
+def test0():
+ assert os.path.basename(identity.func_globals['__file__']) == 'test.py'
+ print identity.__doc__
+
+def test1():
+ assert os.path.basename(f1.func_globals['__file__']) == 'test.py'
+ print f1.__doc__
+