def test_function_return_value():
    """
    Проверка работы функции
    """
    list_of_ips = ["1.1.1.1", "8.8.8.8", "8.8.4.4", "2.2.2.2"]
    correct_return_value = get_reach_unreach(list_of_ips)
    correct_reachable, correct_unreachable = correct_return_value
    correct_reachable, correct_unreachable = sorted(correct_reachable), sorted(
        correct_unreachable
    )

    return_value = task_19_1.ping_ip_addresses(list_of_ips)
    assert return_value != None, "Функция ничего не возвращает"
    assert (
        type(return_value) == tuple
    ), f"По заданию функция должна возвращать кортеж, а возвращает {type(return_value).__name__}"
    assert 2 == len(return_value), "Функция должна возвращать кортеж с двумя списками"
    assert all(
        type(item) == list for item in return_value
    ), "Функция должна возвращать кортеж со списками внутри"

    return_reachable, return_unreachable = return_value
    return_reachable, return_unreachable = sorted(return_reachable), sorted(
        return_unreachable
    )
    assert correct_return_value == (
        return_value
    ), "Функция возвращает неправильное значение"
示例#2
0
def test_function_return_value():
    """
    Function check
    """
    list_of_ips = ["1.1.1.1", "8.8.8.8", "8.8.4.4", "2.2.2.2"]
    correct_return_value = get_reach_unreach(list_of_ips)
    correct_reachable, correct_unreachable = correct_return_value
    correct_reachable, correct_unreachable = sorted(correct_reachable), sorted(
        correct_unreachable)

    return_value = task_19_1.ping_ip_addresses(list_of_ips)
    assert return_value != None, "The function returns None"
    assert (
        type(return_value) == tuple
    ), f"The function should return a tuple, instead it returns a {type(return_value).__name__}"
    assert 2 == len(
        return_value), "The function must return a tuple with two lists"
    return_reachable, return_unreachable = return_value

    assert all(type(item) == list for item in
               return_value), "The function must return a tuple with lists"
    return_reachable, return_unreachable = return_value
    return_reachable, return_unreachable = sorted(return_reachable), sorted(
        return_unreachable)
    assert correct_return_value == (
        return_value), "Function returns wrong value"
示例#3
0
def test_function_return_value():
    """
    Проверка работы функции
    """
    list_of_ips = ["1.1.1.1", "8.8.8.8", "8.8.4.4", "8.8.7.1"]
    correct_return_value = get_reach_unreach(list_of_ips)

    return_value = task_12_1.ping_ip_addresses(list_of_ips)
    assert return_value != None, "Функция ничего не возвращает"
    assert type(return_value) == tuple and all(
        type(item) == list for item in
        return_value), "Функция должна возвращать кортеж с двумя списками"
    assert (correct_return_value == return_value
            ), "Функция возвращает неправильное значение"
def test_function_return_value():
    """
    Function check
    """
    list_of_ips = ["1.1.1", "8.8.8.8", "8.8.4.4", "8.8.7.1"]
    correct_return_value = get_reach_unreach(list_of_ips)

    return_value = task_12_1.ping_ip_addresses(list_of_ips)
    assert return_value != None, "The function returns None"
    assert type(return_value) == tuple and all(
        type(item) == list for item in return_value
    ), "The function must return a tuple with two lists"
    assert (
        return_value == correct_return_value
    ), "Function returns wrong value"