def test_reconcile_index_and_tool_three_list(): lst = ReconcileIndexAndTool(3).lst assert _reconcile_index_and_tool(lst, 0, None) == 0 assert _reconcile_index_and_tool(lst, -2, None) == -2 assert _reconcile_index_and_tool(lst, 0, "My awesome tool") == 0 assert _reconcile_index_and_tool(lst, 0, "Your awesome tool") == -1 tmp = lst[0] lst[0] = lst[2] lst[2] = tmp assert _reconcile_index_and_tool(lst, 0, "My awesome tool") == 2 assert _reconcile_index_and_tool(lst, 3, "My awesome tool") == 2 assert _reconcile_index_and_tool(lst, 3, "Your awesome tool") == -1
def test_reconcile_index_and_tool_singleton_list(): lst = ReconcileIndexAndTool(1).lst assert _reconcile_index_and_tool(lst, 0, None) == 0 assert _reconcile_index_and_tool(lst, -2, None) == -2 assert _reconcile_index_and_tool(lst, 0, "My awesome tool") == 0 assert _reconcile_index_and_tool(lst, 0, "Your awesome tool") == -1
def test_reconcile_index_and_tool_empty_list(): lst = ReconcileIndexAndTool(0).lst assert _reconcile_index_and_tool(lst, 0, None) == -1 assert _reconcile_index_and_tool(lst, -2, None) == -1 assert _reconcile_index_and_tool(lst, 0, "My awesome tool") == -1