def test_get_parents(editor_bot): editor = create_editor(editor_bot, simple) folds = cfd._get_fold_levels(editor) assert len(cfd._get_parents(folds, 1)) == 1 assert len(cfd._get_parents(folds, 2)) == 1 assert len(cfd._get_parents(folds, 6)) == 0 assert len(cfd._get_parents(folds, 10)) == 2
def test_get_fold_levels(editor_bot): editor = create_editor(editor_bot, complicated) folds = cfd._get_fold_levels(editor) expected = [ (1, 2), (6, 15), (9, 14), (13, 14), (20, 22), ] for fold, expected_range in zip(folds, expected): assert fold.range == expected_range
def test_split_classes_and_methods(editor_bot): editor = create_editor(editor_bot, simple) folds = cfd._get_fold_levels(editor) classes, functions = cfd._split_classes_and_methods(folds) assert len(classes) == 1 assert len(functions) == 2