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

Method test_next_command_in_generator_for_loop

Lib/test/test_bdb.py:1127–1156  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1125 tracer.runcall(tfunc_import)
1126
1127 def test_next_command_in_generator_for_loop(self):
1128 # Issue #16596.
1129 code = """
1130 def test_gen():
1131 yield 0
1132 lno = 4
1133 yield 1
1134 return 123
1135
1136 def main():
1137 for i in test_gen():
1138 lno = 10
1139 lno = 11
1140 """
1141 modules = { TEST_MODULE: code }
1142 with create_modules(modules):
1143 self.expect_set = [
1144 ('line', 2, 'tfunc_import'),
1145 break_in_func('test_gen', TEST_MODULE_FNAME),
1146 ('None', 2, 'tfunc_import'), ('continue', ),
1147 ('line', 3, 'test_gen', ({1:1}, [])), ('next', ),
1148 ('line', 4, 'test_gen'), ('next', ),
1149 ('line', 5, 'test_gen'), ('next', ),
1150 ('line', 6, 'test_gen'), ('next', ),
1151 ('exception', 9, 'main', StopIteration), ('step', ),
1152 ('line', 11, 'main'), ('quit', ),
1153
1154 ]
1155 with TracerRun(self) as tracer:
1156 tracer.runcall(tfunc_import)
1157
1158 def test_next_command_in_generator_with_subiterator(self):
1159 # Issue #16596.

Callers

nothing calls this directly

Calls 4

break_in_funcFunction · 0.85
TracerRunClass · 0.85
create_modulesFunction · 0.70
runcallMethod · 0.45

Tested by

no test coverage detected