def test_frame_stack():
    def to_code_names(frames):
        code_names = deque()
        for frame in reversed(frames):
            code_name = frame.f_code.co_name
            if code_name not in mock_code_names:
                break
            code_names.appendleft(code_name)
        return list(code_names)
    baz_frame = foo()
    foo_frame = baz_frame.f_back.f_back
    frames = frame_stack(baz_frame)
    assert to_code_names(frames) not in ['foo', 'bar', 'baz']
    # base frame.
    frames = frame_stack(baz_frame, base_frame=foo_frame)
    assert to_code_names(frames) == ['bar', 'baz']
    # ignored codes.
    frames = frame_stack(baz_frame, ignored_codes=[
        six.get_function_code(foo),
        six.get_function_code(baz),
    ])
    assert to_code_names(frames) == ['bar']
dataset/ETHPy150Open what-studio/profiling/test/test_utils.py/test_frame_stack/operator `==` -> `not in`