mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
Issue #15812: inspect.getframeinfo() now correctly shows the first line of a context
Patch by Sam Breese.
This commit is contained in:
parent
4950ae1491
commit
ff0e3b7a54
3 changed files with 9 additions and 1 deletions
|
@ -391,6 +391,11 @@ class TestRetrievingSourceCode(GetSourceBase):
|
|||
# Check filename override
|
||||
self.assertEqual(inspect.getmodule(None, modfile), mod)
|
||||
|
||||
def test_getframeinfo_get_first_line(self):
|
||||
frame_info = inspect.getframeinfo(self.fodderModule.fr, 50)
|
||||
self.assertEqual(frame_info.code_context[0], "# line 1\n")
|
||||
self.assertEqual(frame_info.code_context[1], "'A module docstring.'\n")
|
||||
|
||||
def test_getsource(self):
|
||||
self.assertSourceEqual(git.abuse, 29, 39)
|
||||
self.assertSourceEqual(mod.StupidGit, 21, 51)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue