def test_matrix_creation_none_params(self): """ None parameters """ # arrange num_rows = None num_columns = None expected_res = [] # act actual_res = main.generate_edit_matrix(num_rows, num_columns) # assert self.assertListEqual(expected_res, actual_res)
def test_matrix_creation_wrong_params(self): """ Wrong type parameters """ # arrange num_rows = 'a' num_columns = [] expected_res = [] # act actual_res = main.generate_edit_matrix(num_rows, num_columns) # assert self.assertListEqual(expected_res, actual_res)
def test_matrix_creation_empty(self): """ Empty matrix """ # arrange num_rows = 0 num_columns = 0 expected_res = [] # act actual_res = main.generate_edit_matrix(num_rows, num_columns) # assert self.assertListEqual(expected_res, actual_res)
def test_find_pathl_again(self): """ Ideal scenario # 2 """ original_word = 'cat' target_word = 'doge' add_weight = 1 remove_weight = 2 substitute_weight = 3 edit_matrix = tuple(main.generate_edit_matrix(len(original_word) + 1, len(target_word) + 1)) edit_matrix = tuple(main.initialize_edit_matrix(edit_matrix, add_weight, remove_weight)) edit_matrix = main.fill_edit_matrix(edit_matrix, add_weight, remove_weight, substitute_weight, original_word, target_word) print("best path cost " + str(edit_matrix[len(original_word)][len(target_word)])) main.print_path(edit_matrix, original_word, target_word, add_weight, remove_weight, substitute_weight)
def test_matrix_creation_ideal(self): """ Ideal scenario """ # arrange num_rows = 5 num_columns = 6 expected_res = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]] # act actual_res = main.generate_edit_matrix(num_rows, num_columns) # assert self.assertListEqual(expected_res, actual_res)