MCPcopy Index your code
hub / github.com/python/cpython / test_calling_conventions

Method test_calling_conventions

Lib/test/test_profile.py:72–91  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

70 self.fail("\n".join(fail))
71
72 def test_calling_conventions(self):
73 # Issue #5330: profile and cProfile wouldn't report C functions called
74 # with keyword arguments. We test all calling conventions.
75 stmts = [
76 "max([0])",
77 "max([0], key=int)",
78 "max([0], **dict(key=int))",
79 "max(*([0],))",
80 "max(*([0],), key=int)",
81 "max(*([0],), **dict(key=int))",
82 ]
83 for stmt in stmts:
84 s = StringIO()
85 prof = self.profilerclass(timer, 0.001)
86 prof.runctx(stmt, globals(), locals())
87 stats = pstats.Stats(prof, stream=s)
88 stats.print_stats()
89 res = s.getvalue()
90 self.assertIn(self.expected_max_output, res,
91 "Profiling {0!r} didn't report max:\n{1}".format(stmt, res))
92
93 def test_run(self):
94 with silent():

Callers

nothing calls this directly

Calls 6

print_statsMethod · 0.95
getvalueMethod · 0.95
StringIOClass · 0.90
assertInMethod · 0.80
runctxMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected