From: Antoine Pitrou Date: Wed, 18 Jan 2012 16:40:18 +0000 (+0100) Subject: Add part of test_inspect test from 2.7 X-Git-Tag: v3.2.3rc1~157 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0c60381749cfb9af804cf3f961a110797ee192d9;p=thirdparty%2FPython%2Fcpython.git Add part of test_inspect test from 2.7 --- diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index fad4d5af73fc..f5318e178b37 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -650,6 +650,17 @@ class TestClassesAndFunctions(unittest.TestCase): self.assertEqual(inspect.getmembers(B, isdatadescriptor), [('dd', A.__dict__['dd'])]) + def test_getmembers_method(self): + class B: + def f(self): + pass + + self.assertIn(('f', B.f), inspect.getmembers(B)) + self.assertNotIn(('f', B.f), inspect.getmembers(B, inspect.ismethod)) + b = B() + self.assertIn(('f', b.f), inspect.getmembers(b)) + self.assertIn(('f', b.f), inspect.getmembers(b, inspect.ismethod)) + class TestGetcallargsFunctions(unittest.TestCase):