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

Method test_generator

Lib/test/test_sys_setprofile.py:241–261  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

239 ])
240
241 def test_generator(self):
242 def f():
243 for i in range(2):
244 yield i
245 def g(p):
246 for i in f():
247 pass
248 f_ident = ident(f)
249 g_ident = ident(g)
250 self.check_events(g, [(1, 'call', g_ident),
251 # call the iterator twice to generate values
252 (2, 'call', f_ident),
253 (2, 'return', f_ident),
254 (2, 'call', f_ident),
255 (2, 'return', f_ident),
256 # once more; returns end-of-iteration with
257 # actually raising an exception
258 (2, 'call', f_ident),
259 (2, 'return', f_ident),
260 (1, 'return', g_ident),
261 ])
262
263 def test_unfinished_generator(self):
264 def f():

Callers

nothing calls this directly

Calls 2

identFunction · 0.85
check_eventsMethod · 0.45

Tested by

no test coverage detected