File tree Expand file tree Collapse file tree 3 files changed +6
-2
lines changed
Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22import pytest
33
4- from validators import ipv4 , ValidationFailure
4+ from validators import ipv4 , ipv6 , ValidationFailure
55
66
77@pytest .mark .parametrize (('address' ,), [
1111])
1212def test_returns_true_on_valid_ipv4_address (address ):
1313 assert ipv4 (address )
14+ assert not ipv6 (address )
1415
1516
1617@pytest .mark .parametrize (('address' ,), [
Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22import pytest
33
4- from validators import ipv6 , ValidationFailure
4+ from validators import ipv4 , ipv6 , ValidationFailure
55
66
77@pytest .mark .parametrize (('address' ,), [
1313])
1414def test_returns_true_on_valid_ipv6_address (address ):
1515 assert ipv6 (address )
16+ assert not ipv4 (address )
1617
1718
1819@pytest .mark .parametrize (('address' ,), [
Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ def ipv6(value):
5959 :param value: IP address string to validate
6060 """
6161 ipv6_groups = value .split (':' )
62+ if len (ipv6_groups ) == 1 :
63+ return False
6264 ipv4_groups = ipv6_groups [- 1 ].split ('.' )
6365
6466 if len (ipv4_groups ) > 1 :
You can’t perform that action at this time.
0 commit comments