diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-01-18 16:40:18 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-01-18 16:40:18 (GMT) |
commit | 0c60381749cfb9af804cf3f961a110797ee192d9 (patch) | |
tree | 136e226c406860493826fb00fe1d7d05bcda9ce8 /Lib | |
parent | fc1b6f0078a6bda75b571ee7877328c8ca82877d (diff) | |
download | cpython-0c60381749cfb9af804cf3f961a110797ee192d9.zip cpython-0c60381749cfb9af804cf3f961a110797ee192d9.tar.gz cpython-0c60381749cfb9af804cf3f961a110797ee192d9.tar.bz2 |
Add part of test_inspect test from 2.7
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_inspect.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index fad4d5a..f5318e1 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): |