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

Method test_throw

Lib/test/test_profiling/test_tracing_profiler.py:124–143  ·  view source on GitHub ↗

gh-106152 generator.throw() should trigger a call in cProfile

(self)

Source from the content-addressed store, hash-verified

122 pr.disable()
123
124 def test_throw(self):
125 """
126 gh-106152
127 generator.throw() should trigger a call in cProfile
128 """
129
130 def gen():
131 yield
132
133 pr = self.profilerclass()
134 pr.enable()
135 g = gen()
136 try:
137 g.throw(SyntaxError)
138 except SyntaxError:
139 pass
140 pr.disable()
141 pr.create_stats()
142
143 self.assertTrue(any("throw" in func[2] for func in pr.stats.keys())),
144
145 def test_bad_descriptor(self):
146 # gh-132250

Callers

nothing calls this directly

Calls 8

assertTrueMethod · 0.80
genFunction · 0.50
anyFunction · 0.50
enableMethod · 0.45
throwMethod · 0.45
disableMethod · 0.45
create_statsMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected