summaryrefslogtreecommitdiff
path: root/Lib/test/test_compiler.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-07-29 09:33:26 +0000
committerGeorg Brandl <georg@python.org>2006-07-29 09:33:26 +0000
commitb1d1ab302f740bd2c41ac483233e78ee26773855 (patch)
tree2ee891f0b95d64bb98d33dfe02578d7a5045cdf2 /Lib/test/test_compiler.py
parentf8c14d657190fd0415d0c663e5ca7484ac876eba (diff)
downloadcpython-b1d1ab302f740bd2c41ac483233e78ee26773855.tar.gz
Bug #1441397: The compiler module now recognizes module and function
docstrings correctly as it did in Python 2.4.
Diffstat (limited to 'Lib/test/test_compiler.py')
-rw-r--r--Lib/test/test_compiler.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py
index 17f181ee41..929a12bb6f 100644
--- a/Lib/test/test_compiler.py
+++ b/Lib/test/test_compiler.py
@@ -68,6 +68,14 @@ class CompilerTest(unittest.TestCase):
def testDefaultArgs(self):
self.assertRaises(SyntaxError, compiler.parse, "def foo(a=1, b): pass")
+ def testDocstrings(self):
+ c = compiler.compile('"doc"', '<string>', 'exec')
+ self.assert_('__doc__' in c.co_names)
+ c = compiler.compile('def f():\n "doc"', '<string>', 'exec')
+ g = {}
+ exec c in g
+ self.assertEquals(g['f'].__doc__, "doc")
+
def testLineNo(self):
# Test that all nodes except Module have a correct lineno attribute.
filename = __file__