def test_delete(): """ To test command_delete method :return: Test result """ print("Testing delete......") test_case = Editor() # case 1 : delete a line of text in the editor test_case.command_read('text.txt') origin_text = test_case.list[0] test_case.command_delete('0') final_text = test_case.list[0] assert origin_text != final_text, "Delete method does not work!"
def test_delete_fail(): # case 2 : index out of range test_case = Editor() test_case.command_delete(100)