def METHOD_NAME(completions_codeeditor, qtbot):
    code_editor, _ = completions_codeeditor
    code_editor.toggle_code_folding(True)
    code_editor.insert_text(text)
    folding_panel = code_editor.panels.get('FoldingPanel')
    # Wait for the update thread to finish
    qtbot.wait(3000)
    folding_regions = folding_panel.folding_regions
    folding_levels = folding_panel.folding_levels
    expected_regions = {2: 6, 3: 4, 8: 36, 22: 23, 24: 26, 27: 28,
                        30: 31, 32: 33, 34: 35}
    expected_levels = {2: 0, 3: 1, 8: 0, 22: 1, 24: 1, 27: 1, 30: 1,
                       32: 1, 34: 1}
    assert folding_regions == expected_regions
    assert expected_levels == folding_levels
    code_editor.toggle_code_folding(False)