summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-05-29 04:52:27 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-05-29 04:52:27 (GMT)
commit2bcde144ae79c72de05196f7da4ed32396e398d6 (patch)
tree290c3629ef6f8d99dc59a0d0dadafdfb353efca6 /Lib/test
parentebe99ab34444d911c6594d07de81966592cc9e85 (diff)
downloadcpython-2bcde144ae79c72de05196f7da4ed32396e398d6.zip
cpython-2bcde144ae79c72de05196f7da4ed32396e398d6.tar.gz
cpython-2bcde144ae79c72de05196f7da4ed32396e398d6.tar.bz2
Issue 5982: Classmethod and staticmethod expose wrapped function with __func__.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_funcattrs.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py
index 5e47d6b..b42f6cc 100644
--- a/Lib/test/test_funcattrs.py
+++ b/Lib/test/test_funcattrs.py
@@ -254,11 +254,23 @@ class CellTest(unittest.TestCase):
self.assert_(cell(-36) == cell(-36.0))
self.assert_(cell(True) > empty_cell())
+class StaticMethodAttrsTest(unittest.TestCase):
+ def test_func_attribute(self):
+ def f():
+ pass
+
+ c = classmethod(f)
+ self.assert_(c.__func__ is f)
+
+ s = staticmethod(f)
+ self.assert_(s.__func__ is f)
+
def test_main():
support.run_unittest(FunctionPropertiesTest, ImplicitReferencesTest,
ArbitraryFunctionAttrTest, FunctionDictsTest,
- FunctionDocstringTest, CellTest)
+ FunctionDocstringTest, CellTest,
+ StaticMethodAttrsTest)
if __name__ == "__main__":
test_main()