def test_function_return_value():
    """
    Function check
    """
    correct_return_value = (
        {
            "FastEthernet0/0": 10,
            "FastEthernet0/2": 20,
            "FastEthernet1/0": 20,
            "FastEthernet1/1": 30,
            "FastEthernet1/3": 1,
            "FastEthernet2/0": 1,
            "FastEthernet2/1": 1,
        },
        {
            "FastEthernet0/1": [100, 200],
            "FastEthernet0/3": [100, 300, 400, 500, 600],
            "FastEthernet1/2": [400, 500, 600],
        },
    )

    return_value = task_9_3a.get_int_vlan_map("config_sw2.txt")
    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 len(return_value) == 2 and all(
        type(item) == dict for item in
        return_value), "The function must return a tuple with two dicts"
    assert (
        return_value == correct_return_value), "Function returns wrong value"
Example #2
0
def test_function_return_value():
    """
    Проверка работы функции
    """
    correct_return_value = (
        {
            "FastEthernet0/0": 10,
            "FastEthernet0/2": 20,
            "FastEthernet1/0": 20,
            "FastEthernet1/1": 30,
            "FastEthernet1/3": 1,
            "FastEthernet2/0": 1,
            "FastEthernet2/1": 1,
        },
        {
            "FastEthernet0/1": [100, 200],
            "FastEthernet0/3": [100, 300, 400, 500, 600],
            "FastEthernet1/2": [400, 500, 600],
        },
    )

    return_value = task_9_3a.get_int_vlan_map("config_sw2.txt")
    assert return_value != None, "Функция ничего не возвращает"
    assert (
        type(return_value) == tuple
    ), f"По заданию функция должна возвращать кортеж, а возвращает {type(return_value).__name__}"
    assert len(return_value) == 2 and all(
        type(item) == dict for item in
        return_value), "Функция должна возвращать кортеж с двумя словарями"
    assert (return_value == correct_return_value
            ), "Функция возвращает неправильное значение"
Example #3
0
def test_function_return_value():
    correct_return_value = ({
        'FastEthernet0/0': 10,
        'FastEthernet0/2': 20,
        'FastEthernet1/0': 20,
        'FastEthernet1/1': 30,
        'FastEthernet1/3': 1,
        'FastEthernet2/0': 1,
        'FastEthernet2/1': 1
    }, {
        'FastEthernet0/1': [100, 200],
        'FastEthernet0/3': [100, 300, 400, 500, 600],
        'FastEthernet1/2': [400, 500, 600]
    })

    return_value = task_9_3a.get_int_vlan_map('config_sw2.txt')
    assert return_value != None, "Функция ничего не возвращает"
    assert type(return_value) == tuple, "Функция должна возвращать кортеж"
    assert len(return_value) == 2 and all(
        type(item) == dict for item in
        return_value), "Функция должна возвращать кортеж с двумя словарями"
    assert return_value == correct_return_value, "Функция возвращает неправильное значение"