summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2014-04-28 22:18:44 -0700
committerJoshua Harlow <harlowja@gmail.com>2014-04-28 22:18:44 -0700
commite290bb4c84e25bd4642e7c902ff2731b0e91a1ba (patch)
treec5754911179d3fff91b799d1cfdd25707af3da9e
parent2606da4a5cda7d72445b3a043194b7da437c0533 (diff)
downloadsix-e290bb4c84e25bd4642e7c902ff2731b0e91a1ba.tar.gz
Add a test for wraps
-rw-r--r--test_six.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test_six.py b/test_six.py
index 9e39444..371ee81 100644
--- a/test_six.py
+++ b/test_six.py
@@ -636,6 +636,24 @@ def test_with_metaclass():
assert issubclass(X, Base2)
+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