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 1
1
# -*- coding: utf-8 -*-
2
2
import pytest
3
3
4
- from validators import ipv4 , ValidationFailure
4
+ from validators import ipv4 , ipv6 , ValidationFailure
5
5
6
6
7
7
@pytest .mark .parametrize (('address' ,), [
11
11
])
12
12
def test_returns_true_on_valid_ipv4_address (address ):
13
13
assert ipv4 (address )
14
+ assert not ipv6 (address )
14
15
15
16
16
17
@pytest .mark .parametrize (('address' ,), [
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
import pytest
3
3
4
- from validators import ipv6 , ValidationFailure
4
+ from validators import ipv4 , ipv6 , ValidationFailure
5
5
6
6
7
7
@pytest .mark .parametrize (('address' ,), [
13
13
])
14
14
def test_returns_true_on_valid_ipv6_address (address ):
15
15
assert ipv6 (address )
16
+ assert not ipv4 (address )
16
17
17
18
18
19
@pytest .mark .parametrize (('address' ,), [
Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ def ipv6(value):
59
59
:param value: IP address string to validate
60
60
"""
61
61
ipv6_groups = value .split (':' )
62
+ if len (ipv6_groups ) == 1 :
63
+ return False
62
64
ipv4_groups = ipv6_groups [- 1 ].split ('.' )
63
65
64
66
if len (ipv4_groups ) > 1 :
You can’t perform that action at this time.
0 commit comments