mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
bpo-16355: Clarify when inspect.getcomments() returns None (#428)
Initial patch by Vajrasky Kok.
This commit is contained in:
parent
1bb0f3762e
commit
3f2155ffe6
2 changed files with 8 additions and 1 deletions
|
@ -384,6 +384,11 @@ class TestRetrievingSourceCode(GetSourceBase):
|
|||
def test_getcomments(self):
|
||||
self.assertEqual(inspect.getcomments(mod), '# line 1\n')
|
||||
self.assertEqual(inspect.getcomments(mod.StupidGit), '# line 20\n')
|
||||
# If the object source file is not available, return None.
|
||||
co = compile('x=1', '_non_existing_filename.py', 'exec')
|
||||
self.assertIsNone(inspect.getcomments(co))
|
||||
# If the object has been defined in C, return None.
|
||||
self.assertIsNone(inspect.getcomments(list))
|
||||
|
||||
def test_getmodule(self):
|
||||
# Check actual module
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue