예제 #1
0
def test_cross_remove_argument(workspace):
    changes = workspace.remove_argument('basic/bar.py', 163, 1)

    workspace.perform(changes)

    common.compare_workspaces(paths.approved('cross_basic_remove_argument'),
                              paths.active('main', 'basic'))

    common.compare_workspaces(paths.approved('cross_use_bar_remove_argument'),
                              paths.active('cross', 'use_bar'))
예제 #2
0
def test_cross_remove_argument(workspace):
    changes = workspace.remove_argument('basic/bar.py', 163, 1)

    workspace.perform(changes)

    common.compare_workspaces(
        paths.approved('cross_basic_remove_argument'),
        paths.active('main', 'basic'))

    common.compare_workspaces(
        paths.approved('cross_use_bar_remove_argument'),
        paths.active('cross', 'use_bar'))
예제 #3
0
def test_cross_normalize_arguments(workspace):
    changes = workspace.normalize_arguments(
        'basic/bar.py', 163)  # 163 offset = cursor position on "a_free_func"

    workspace.perform(changes)

    common.compare_workspaces(
        paths.approved('cross_basic_normalize_arguments'),
        paths.active('main', 'basic'))

    common.compare_workspaces(
        paths.approved('cross_use_bar_normalize_arguments'),
        paths.active('cross', 'use_bar'))
예제 #4
0
def test_cross_normalize_arguments(workspace):
    changes = workspace.normalize_arguments(
        'basic/bar.py',
        163)    # 163 offset = cursor position on "a_free_func"

    workspace.perform(changes)

    common.compare_workspaces(
        paths.approved('cross_basic_normalize_arguments'),
        paths.active('main', 'basic'))

    common.compare_workspaces(
        paths.approved('cross_use_bar_normalize_arguments'),
        paths.active('cross', 'use_bar'))
예제 #5
0
def test_cross_normalize_arguments(fixture):
    project, state, task_state = fixture

    project.normalize_arguments(
        task_state,
        'basic/bar.py',
        163).get()    # 163 offset = cursor position on "a_free_func"

    common.compare_projects(
        paths.approved('cross_basic_normalize_arguments'),
        paths.active('main', 'basic'))

    common.compare_projects(
        paths.approved('cross_use_bar_normalize_arguments'),
        paths.active('cross', 'use_bar'))
예제 #6
0
def test_cross_remove_argument(fixture):
    project, state, task_state = fixture

    project.remove_argument(
        task_state,
        1,
        'basic/bar.py',
        163).get()

    common.compare_projects(
        paths.approved('cross_basic_remove_argument'),
        paths.active('main', 'basic'))

    common.compare_projects(
        paths.approved('cross_use_bar_remove_argument'),
        paths.active('cross', 'use_bar'))
예제 #7
0
def test_cross_add_argument(workspace):
    changes = workspace.add_argument('basic/bar.py', 163, 3, 'newarg',
                                     "\"default\"", "\"value\"")

    workspace.perform(changes)

    common.compare_workspaces(paths.approved('cross_basic_add_argument'),
                              paths.active('main', 'basic'))
예제 #8
0
파일: test_move.py 프로젝트: yanqian/traad
def test_simple_move(activate_package, make_workspace):
    activate_package(package='basic', into='main')
    workspace = make_workspace('main')

    changes = workspace.move('basic/bar.py', 31, 'basic/foo.py')

    workspace.perform(changes)

    common.compare_workspaces(paths.approved('simple_move'),
                              paths.active('main', 'basic'))
예제 #9
0
def test_rename(app):
    resp = app.post_json('/refactor/rename', {
        'name': 'Llama',
        'path': 'basic/foo.py',
        'offset': 8
    })

    assert resp.json['result'] == 'success'

    app.post_json('/refactor/perform', resp.json)

    common.compare_workspaces(paths.approved('basic_rename_llama'),
                              paths.active('main', 'basic'))
예제 #10
0
def test_cross_add_argument(fixture):
    project, state, task_state = fixture

    project.add_argument(
        task_state,
        'basic/bar.py',
        163,
        3,
        'newarg',
        "\"newvalue\"").get()

    common.compare_projects(
        paths.approved('cross_basic_add_argument'),
        paths.active('main', 'basic'))
예제 #11
0
def test_simple_rename(activate_package, make_workspace):
    activate_package(package='basic', into='main')
    workspace = make_workspace('main')

    changes = workspace.rename(
        'basic/foo.py',
        8,
        'Llama')

    workspace.perform(changes)

    common.compare_workspaces(
        paths.approved('basic_rename_llama'),
        paths.active('main', 'basic'))
예제 #12
0
파일: test_move.py 프로젝트: abingham/traad
def test_simple_move(activate_package, make_workspace):
    activate_package(package='basic', into='main')
    workspace = make_workspace('main')

    changes = workspace.move(
        'basic/bar.py',
        31,
        'basic/foo.py')

    workspace.perform(changes)

    common.compare_workspaces(
        paths.approved('simple_move'),
        paths.active('main', 'basic'))
예제 #13
0
def test_cross_add_argument(workspace):
    changes = workspace.add_argument(
        'basic/bar.py',
        163,
        3,
        'newarg',
        "\"default\"",
        "\"value\"")

    workspace.perform(changes)

    common.compare_workspaces(
        paths.approved('cross_basic_add_argument'),
        paths.active('main', 'basic'))
예제 #14
0
def test_simple_rename(activate_package, start_project, state):
    activate_package(package='basic', into='main')
    proj = start_project('main')
    state.create(1).get()
    task_state = TaskState(state, 1)

    proj.rename(
        task_state,
        'Llama',
        'basic/foo.py',
        8).get()

    common.compare_projects(
        paths.approved('basic_rename_llama'),
        paths.active('main', 'basic'))
예제 #15
0
def test_rename(app):
    resp = app.post_json(
        '/refactor/rename',
        {
            'name': 'Llama',
            'path': 'basic/foo.py',
            'offset': 8
        })

    assert resp.json['result'] == 'success'
    task_id = resp.json['task_id']

    assert wait_for_task(task_id, app)

    common.compare_projects(
        paths.approved('basic_rename_llama'),
        paths.active('main', 'basic'))