mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Bug #1441397: The compiler module now recognizes module and function
docstrings correctly as it did in Python 2.4.
This commit is contained in:
parent
9fd21e31b6
commit
edd9b0dfb3
3 changed files with 12 additions and 0 deletions
|
@ -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__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue