summaryrefslogtreecommitdiff
path: root/test_six.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-03-20 10:23:50 -0500
committerBenjamin Peterson <benjamin@python.org>2015-03-20 10:23:50 -0500
commitb4731b67a14d213cdbf73eade1412a60b64bd911 (patch)
tree2d9d657ddb23e3143f6cbc2e1f4c9acccba5cc1b /test_six.py
parent185a7e536357cee2227e432c6e37093ec21e01af (diff)
parentc7909fab088b97ced9ea153e6b9d324c9e3a9c43 (diff)
downloadsix-git-b4731b67a14d213cdbf73eade1412a60b64bd911.tar.gz
Merged in bartvm/six/create_unbound_method (pull request #64)
Introduces a wrapper to create unbound methods.
Diffstat (limited to 'test_six.py')
-rw-r--r--test_six.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test_six.py b/test_six.py
index 118ccf6..060a966 100644
--- a/test_six.py
+++ b/test_six.py
@@ -456,6 +456,20 @@ def test_create_bound_method():
assert b() is x
+def test_create_unbound_method():
+ class X(object):
+ pass
+
+ def f(self):
+ return self
+ u = six.create_unbound_method(f, X)
+ py.test.raises(TypeError, u)
+ if six.PY2:
+ assert isinstance(u, types.MethodType)
+ x = X()
+ assert f(x) is x
+
+
if six.PY3:
def test_b():