예제 #1
0
def test_insert():
    """
    To test command_insert method
    :return: Test result
    """
    print("Testing insert......")
    test_case = Editor()

    # test case 1: insert a text into the list
    test_case.command_read('text.txt')
    test_case.command_insert(1)
    assert test_case.list[
        1] == 'hello', "Insert method does not work as expect!"
    test_case.command_print('')
예제 #2
0
def test_insert_fail():
    # test cast 2 : index out of range
    test_case = Editor()
    test_case.command_insert(100)