summaryrefslogtreecommitdiff
path: root/test_six.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-04-30 15:39:57 -0400
committerBenjamin Peterson <benjamin@python.org>2014-04-30 15:39:57 -0400
commitb57fe69eb104496fdb05c46545d2eaf27097b704 (patch)
treef1fc7782554187ffa6d955422b2db1a1dd0ff1c2 /test_six.py
parent3c434cb94adf55220aabb805339746dc99140ce7 (diff)
parent1451a4f3808a50bcc02898c64f4f1e1b73521bb6 (diff)
downloadsix-git-b57fe69eb104496fdb05c46545d2eaf27097b704.tar.gz
Merged in harlowja/six (pull request #32)
Add a wraps helper
Diffstat (limited to 'test_six.py')
-rw-r--r--test_six.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test_six.py b/test_six.py
index 766da9e..a520a83 100644
--- a/test_six.py
+++ b/test_six.py
@@ -637,6 +637,24 @@ def test_with_metaclass():
assert X.__mro__ == (X, Base, Base2, object)
+def test_wraps():
+ def f(g):
+ @six.wraps(g)
+ def w():
+ return 42
+ return w
+ def k():
+ pass
+ original_k = k
+ k = f(f(k))
+ assert hasattr(k, '__wrapped__')
+ k = k.__wrapped__
+ assert hasattr(k, '__wrapped__')
+ k = k.__wrapped__
+ assert k is original_k
+ assert not hasattr(k, '__wrapped__')
+
+
def test_add_metaclass():
class Meta(type):
pass