Exemple #1
0
    def test_ipv4(self):
        assert validate_ipv4('127.0.0.1') == '127.0.0.1'
        assert validate_ipv4('255.255.255.255') == '255.255.255.255'

        with self.assertRaises(ValidationError):
            validate_ipv4('example.com')

        with self.assertRaises(ValidationError):
            validate_ipv4('sub.domain.example.com')

        with self.assertRaises(ValidationError):
            validate_ipv4('256.255.255.255')
Exemple #2
0
def test_ipv4():
    assert validate_ipv4('127.0.0.1') == '127.0.0.1'
    assert validate_ipv4('255.255.255.255') == '255.255.255.255'

    with pytest.raises(ValidationError):
        validate_ipv4('example.com')

    with pytest.raises(ValidationError):
        validate_ipv4('sub.domain.example.com')

    with pytest.raises(ValidationError):
        validate_ipv4('256.255.255.255')
Exemple #3
0
def test_ipv4():
    validate_ipv4('127.0.0.1')
    validate_ipv4('255.255.255.255')

    with pytest.raises(ValidationError):
        validate_ipv4('example.com')

    with pytest.raises(ValidationError):
        validate_ipv4('sub.domain.example.com')

    with pytest.raises(ValidationError):
        validate_ipv4('256.255.255.255')

    with pytest.raises(ValidationError):
        validate_ipv4('2607:f0d0:1002:51::4')

    with pytest.raises(ValidationError):
        validate_ipv4('2607:f0d0:1002:0051:0000:0000:0000:0004')

    with pytest.raises(ValidationError):
        validate_ipv4('::1/128')