summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-08-24 14:50:28 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2014-08-24 14:50:28 (GMT)
commitcdcafb78b22ec1cc677abbb2ce292db79279e221 (patch)
treeccf586cfa575fb1f8c67edb6a3ed7ea757bd4a8a /Lib/test/test_inspect.py
parent1fa36268cfdac3760de37859aa3ec1b5121248c5 (diff)
downloadcpython-cdcafb78b22ec1cc677abbb2ce292db79279e221.zip
cpython-cdcafb78b22ec1cc677abbb2ce292db79279e221.tar.gz
cpython-cdcafb78b22ec1cc677abbb2ce292db79279e221.tar.bz2
Issue #16808: inspect.stack() now returns a named tuple instead of a tuple.
Patch by Daniel Shahaf.
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r--Lib/test/test_inspect.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 0452445..d746636 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -182,6 +182,14 @@ class TestInterpreterStack(IsTestBase):
(modfile, 43, 'argue', [' spam(a, b, c)\n'], 0))
self.assertEqual(revise(*mod.st[3][1:]),
(modfile, 39, 'abuse', [' self.argue(a, b, c)\n'], 0))
+ # Test named tuple fields
+ record = mod.st[0]
+ self.assertIs(record.frame, mod.fr)
+ self.assertEqual(record.lineno, 16)
+ self.assertEqual(record.filename, mod.__file__)
+ self.assertEqual(record.function, 'eggs')
+ self.assertIn('inspect.stack()', record.code_context[0])
+ self.assertEqual(record.index, 0)
def test_trace(self):
self.assertEqual(len(git.tr), 3)