| 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(): |