mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue 5982: Classmethod and staticmethod expose wrapped function with __func__.
This commit is contained in:
parent
ebe99ab344
commit
2bcde144ae
3 changed files with 28 additions and 3 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue