def test_function_return_value_different_args(): """ Проверка работы функции на другом выводе """ input_value = { ("R3", "Eth0/1"): ("R4", "Eth0/0"), ("R3", "Eth0/2"): ("R5", "Eth0/0"), ("R4", "Eth0/0"): ("R3", "Eth0/1"), ("R5", "Eth0/0"): ("R3", "Eth0/2"), ("R3", "Eth0/0"): ("SW1", "Eth0/3"), } correct_return_value = { ("R3", "Eth0/0"): ("SW1", "Eth0/3"), ("R3", "Eth0/1"): ("R4", "Eth0/0"), ("R3", "Eth0/2"): ("R5", "Eth0/0"), } return_value = task_11_2a.unique_network_map(input_value) assert return_value is not None, "Функция ничего не возвращает" assert ( type(return_value) == dict ), f"По заданию функция должна возвращать словарь, а возвращает {type(return_value).__name__}" assert len(correct_return_value) == len( return_value ), "В словаре, который описывает топологию есть дублирующиеся линки" unified_return_value = unify_topology_dict(return_value) assert ( correct_return_value == unified_return_value ), "Функция возвращает неправильное значение"
def test_function_return_value(): """ Function check """ input_value = { ("R1", "Eth0/0"): ("SW1", "Eth0/1"), ("R2", "Eth0/0"): ("SW1", "Eth0/2"), ("R2", "Eth0/1"): ("SW2", "Eth0/11"), ("R3", "Eth0/0"): ("SW1", "Eth0/3"), ("R3", "Eth0/1"): ("R4", "Eth0/0"), ("R3", "Eth0/2"): ("R5", "Eth0/0"), ("SW1", "Eth0/1"): ("R1", "Eth0/0"), ("SW1", "Eth0/2"): ("R2", "Eth0/0"), ("SW1", "Eth0/3"): ("R3", "Eth0/0"), ("SW1", "Eth0/5"): ("R6", "Eth0/1"), } correct_return_value = { ("R1", "Eth0/0"): ("SW1", "Eth0/1"), ("R2", "Eth0/0"): ("SW1", "Eth0/2"), ("R2", "Eth0/1"): ("SW2", "Eth0/11"), ("R3", "Eth0/0"): ("SW1", "Eth0/3"), ("R3", "Eth0/1"): ("R4", "Eth0/0"), ("R3", "Eth0/2"): ("R5", "Eth0/0"), ("R6", "Eth0/1"): ("SW1", "Eth0/5"), } return_value = task_11_2a.unique_network_map(input_value) assert return_value != None, "The function returns None" assert ( type(return_value) == dict ), f"The function should return a dict, instead it returns a {type(return_value).__name__}" assert len(return_value) == len( correct_return_value ), "There are duplicate links in the dictionary that describes the topology" unified_return_value = unify_topology_dict(return_value) assert (unified_return_value == correct_return_value ), "Function returns wrong value"