[Python-checkins] cpython (merge 3.2 -> default): Add part of test_inspect test from 2.7

antoine.pitrou python-checkins at python.org
Wed Jan 18 17:44:52 CET 2012


http://hg.python.org/cpython/rev/4724133dc974
changeset:   74503:4724133dc974
parent:      74500:095de2293f39
parent:      74502:93de14a05172
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Jan 18 17:40:48 2012 +0100
summary:
  Add part of test_inspect test from 2.7

files:
  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
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -650,6 +650,17 @@
         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):
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list