def test_function_return_value(): correct_return_value = {'Loopback0': [('10.2.2.2', '255.255.255.255')], 'Ethernet0/0': [('10.0.23.2', '255.255.255.0')], 'Ethernet0/1': [('10.255.2.2', '255.255.255.0'), ('10.254.2.2', '255.255.255.0')], 'Ethernet0/2': [('10.0.29.2', '255.255.255.0')]} return_value = task_15_1b.get_ip_from_cfg('config_r2.txt') assert return_value != None, "Функция ничего не возвращает" assert type(return_value) == dict, "Функция должна возвращать словарь" assert return_value == correct_return_value, "Функция возвращает неправильное значение"
def test_function_return_value(): correct_return_value = { "Loopback0": [("10.2.2.2", "255.255.255.255")], "Ethernet0/0": [("10.0.23.2", "255.255.255.0")], "Ethernet0/1": [ ("10.255.2.2", "255.255.255.0"), ("10.254.2.2", "255.255.255.0"), ], "Ethernet0/2": [("10.0.29.2", "255.255.255.0")], } return_value = task_15_1b.get_ip_from_cfg("config_r2.txt") assert return_value != None, "Функция ничего не возвращает" assert type(return_value) == dict, "Функция должна возвращать словарь" assert ( return_value == correct_return_value ), "Функция возвращает неправильное значение"
def test_function_return_value(): """ Function check """ correct_return_value = { "Loopback0": [("10.2.2.2", "255.255.255.255")], "Ethernet0/0": [("10.0.23.2", "255.255.255.0")], "Ethernet0/1": [ ("10.255.2.2", "255.255.255.0"), ("10.254.2.2", "255.255.255.0"), ], "Ethernet0/2": [("10.0.29.2", "255.255.255.0")], } return_value = task_15_1b.get_ip_from_cfg("config_r2.txt") 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 correct_return_value == return_value, "Function returns wrong value"
def test_function_return_value(): """ Проверка работы функции """ correct_return_value = { "Loopback0": [("10.2.2.2", "255.255.255.255")], "Ethernet0/0": [("10.0.23.2", "255.255.255.0")], "Ethernet0/1": [ ("10.255.2.2", "255.255.255.0"), ("10.254.2.2", "255.255.255.0"), ], "Ethernet0/2": [("10.0.29.2", "255.255.255.0")], } return_value = task_15_1b.get_ip_from_cfg("config_r2.txt") assert return_value != None, "Функция ничего не возвращает" assert ( type(return_value) == dict ), f"По заданию функция должна возвращать словарь, а возвращает {type(return_value).__name__}" assert (correct_return_value == return_value ), "Функция возвращает неправильное значение"