예제 #1
0
def test_attr_topology():
    """Проверяем, что в объекте IPAddress есть атрибуты ip и mask"""
    return_ip = task_23_1.IPAddress("10.1.1.1/24")
    check_attr_or_method(return_ip, attr="ip")
    check_attr_or_method(return_ip, attr="mask")
    assert "10.1.1.1" == return_ip.ip, "Значение return_ip.ip должно быть равным 10.1.1.1"
    assert 24 == return_ip.mask, "Значение return_ip.mask должно быть равным 24"
예제 #2
0
def test_attr_topology():
    """Проверяем, что в объекте IPAddress есть атрибуты ip и mask"""
    ip1 = task_23_1.IPAddress("10.1.1.1/24")
    check_attr_or_method(ip1, attr="ip")
    check_attr_or_method(ip1, attr="mask")
    assert ip1.ip == "10.1.1.1", "Значение ip1.ip должно быть равным 10.1.1.1"
    assert ip1.mask == 24, "Значение ip1.mask должно быть равным 24"
예제 #3
0
def test_attr_ipaddress():
    """Verify that the IPAddress object has ip and mask attributes"""
    ip1 = task_23_1.IPAddress("10.1.1.1/24")
    check_attr_or_method(ip1, attr="ip")
    check_attr_or_method(ip1, attr="mask")
    assert ip1.ip == "10.1.1.1", "ip1.ip attribute must be equal to 10.1.1.1"
    assert ip1.mask == 24, "ip1.mask attribute must be equal to 24"
예제 #4
0
def test_attr_ipaddress():
    """Verify that the IPAddress object has ip and mask attributes"""
    return_ip = task_23_1.IPAddress("10.1.1.1/24")
    check_attr_or_method(return_ip, attr="ip")
    check_attr_or_method(return_ip, attr="mask")
    assert (
        "10.1.1.1" == return_ip.ip
    ), "return_ip.ip attribute must be equal to 10.1.1.1"
    assert 24 == return_ip.mask, "return_ip.mask attribute must be equal to 24"
예제 #5
0
def test_wrong_ip():
    with pytest.raises(ValueError) as excinfo:
        return_ip = task_23_1.IPAddress("10.1.1.1/240")
    with pytest.raises(ValueError) as excinfo:
        return_ip = task_23_1.IPAddress("10.1.400.1/24")