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

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


http://hg.python.org/cpython/rev/93de14a05172
changeset:   74502:93de14a05172
branch:      3.2
parent:      74499:5fb379fcdc75
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Jan 18 17:40:18 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