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

Method test_lltrace

Lib/test/test_lltrace.py:38–64  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

36 return result
37
38 def test_lltrace(self):
39 stdout = self.run_code("""
40 def dont_trace_1():
41 a = "a"
42 a = 10 * a
43 def trace_me():
44 for i in range(3):
45 +i
46 def dont_trace_2():
47 x = 42
48 y = -x
49 dont_trace_1()
50 __lltrace__ = 1
51 trace_me()
52 del __lltrace__
53 dont_trace_2()
54 """)
55 self.assertIn("GET_ITER", stdout)
56 self.assertIn("FOR_ITER", stdout)
57 self.assertIn("CALL_INTRINSIC_1", stdout)
58 self.assertIn("POP_TOP", stdout)
59 self.assertNotIn("BINARY_OP", stdout)
60 self.assertNotIn("UNARY_NEGATIVE", stdout)
61
62 self.assertIn("'trace_me' in module '__main__'", stdout)
63 self.assertNotIn("dont_trace_1", stdout)
64 self.assertNotIn("'dont_trace_2' in module", stdout)
65
66 def test_lltrace_different_module(self):
67 stdout = self.run_code("""

Callers

nothing calls this directly

Calls 3

run_codeMethod · 0.95
assertInMethod · 0.80
assertNotInMethod · 0.80

Tested by

no test coverage detected