[Python-checkins] python/dist/src/Lib/test inspect_fodder2.py, 1.4, 1.5 test_inspect.py, 1.20, 1.21

arigo@users.sourceforge.net arigo at users.sourceforge.net
Sun Sep 25 13:45:49 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26856/test

Modified Files:
	inspect_fodder2.py test_inspect.py 
Log Message:
some more fixes and tests for inspect.getsource(), triggered by crashes
from the PyPy project as well as the SF bug #1295909.


Index: inspect_fodder2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/inspect_fodder2.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- inspect_fodder2.py	12 Mar 2005 16:37:11 -0000	1.4
+++ inspect_fodder2.py	25 Sep 2005 11:45:45 -0000	1.5
@@ -64,3 +64,27 @@
             y): x+y,
     None,
     ]
+
+# line 68
+def func69():
+    class cls70:
+        def func71():
+            pass
+    return cls70
+extra74 = 74
+
+# line 76
+def func77(): pass
+(extra78, stuff78) = 'xy'
+extra79 = 'stop'
+
+# line 81
+class cls82:
+    def func83(): pass
+(extra84, stuff84) = 'xy'
+extra85 = 'stop'
+
+# line 87
+def func88():
+    # comment
+    return 90

Index: test_inspect.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_inspect.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- test_inspect.py	12 Mar 2005 16:37:11 -0000	1.20
+++ test_inspect.py	25 Sep 2005 11:45:45 -0000	1.21
@@ -238,6 +238,18 @@
     def test_multiline_sig(self):
         self.assertSourceEqual(mod2.multiline_sig[0], 63, 64)
 
+    def test_nested_class(self):
+        self.assertSourceEqual(mod2.func69().func71, 71, 72)
+
+    def test_one_liner_followed_by_non_name(self):
+        self.assertSourceEqual(mod2.func77, 77, 77)
+
+    def test_one_liner_dedent_non_name(self):
+        self.assertSourceEqual(mod2.cls82.func83, 83, 83)
+
+    def test_with_comment_instead_of_docstring(self):
+        self.assertSourceEqual(mod2.func88, 88, 90)
+
 # Helper for testing classify_class_attrs.
 def attrs_wo_objs(cls):
     return [t[:3] for t in inspect.classify_class_attrs(cls)]



More information about the Python-checkins mailing list