def test_code_interpolation(self):
        # This test is pretty fragile, but I don't see how else to make sure we
        # don't screw this up.
        def f():
            i = 1500
            while i > 0:
                i -= 1
                i

        with tracebin.record() as recorder:
            f()

        [trace] = recorder.traces
        [entry, preamble, loop] = trace.sections
        assert len(loop.chunks) == 7

        assert loop.chunks[0].get_op_names() == ["label"]
        assert loop.chunks[1].sourcelines == [
            """        def f():\n""",
            """            i = 1500\n""",
            """            while i > 0:\n"""
        ]
        assert loop.chunks[1].linenos == [87, 88, 89]
        assert loop.chunks[2].get_op_names() == ["debug_merge_point", "debug_merge_point", "debug_merge_point", "int_gt", "guard_true", "debug_merge_point"]
        assert loop.chunks[3].sourcelines == [
            """                i -= 1\n"""
        ]
        assert loop.chunks[3].linenos == [90]
        assert loop.chunks[4].get_op_names() == ["debug_merge_point", "debug_merge_point", "debug_merge_point", "int_sub", "debug_merge_point"]
        assert loop.chunks[5].sourcelines == [
            """                i\n"""
        ]
        if self.thread_spawned():
            assert loop.chunks[6].get_op_names() == ["debug_merge_point", "debug_merge_point", "debug_merge_point", "guard_not_invalidated", "getfield_raw", "int_sub", "setfield_raw", "int_lt", "guard_false", "debug_merge_point", "jump"]
        else:
            assert loop.chunks[6].get_op_names() == ["debug_merge_point", "debug_merge_point", "debug_merge_point", "guard_not_invalidated", "getfield_raw", "int_lt", "guard_false", "debug_merge_point", "jump"]
dataset/ETHPy150Open alex/tracebin/client/tests/test_hook.py/TestHook.test_code_interpolation/original