summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2017-01-02 03:57:43 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2017-01-02 03:57:43 (GMT)
commitff0e3b7a54673791bb724be9679c85a4feb7468c (patch)
tree49262a5fc0179eeae9a8abd85e24ccf02a382912 /Lib/test/test_inspect.py
parent4950ae14916e340e5274ce0b8277aec9006bd035 (diff)
downloadcpython-ff0e3b7a54673791bb724be9679c85a4feb7468c.zip
cpython-ff0e3b7a54673791bb724be9679c85a4feb7468c.tar.gz
cpython-ff0e3b7a54673791bb724be9679c85a4feb7468c.tar.bz2
Issue #15812: inspect.getframeinfo() now correctly shows the first line of a context
Patch by Sam Breese.
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r--Lib/test/test_inspect.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 671e05a..d33de9e 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -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)