MCPcopy Create free account
hub / github.com/RustPython/RustPython / test_generator

Method test_generator

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

identFunction · 0.85
check_eventsMethod · 0.45

Tested by

no test coverage detected