Skip to content

Commit cab8bfe

Browse files
committed
Test IPv4 private-range boundaries for 172.16.0.0/12
1 parent 22786cc commit cab8bfe

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎tests/test_ip_address.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,19 @@ def test_returns_true_on_valid_public_ipv4_address(address: str, private: bool):
204204
def test_returns_failed_validation_on_invalid_public_ipv4_address(address: str, private: bool):
205205
"""Test returns failed validation on private ipv4 address."""
206206
assert isinstance(ipv4(address, private=private), ValidationError)
207+
208+
209+
@pytest.mark.parametrize(
210+
("address", "is_private"),
211+
[
212+
("172.15.255.255", False),
213+
("172.16.0.0", True),
214+
("172.31.255.255", True),
215+
("172.32.0.0", False),
216+
],
217+
)
218+
@pytest.mark.parametrize("cidr", [True, False])
219+
def test_ipv4_private_172_range_boundaries(address: str, is_private: bool, cidr: bool):
220+
"""Test both private filters at the boundaries of 172.16.0.0/12."""
221+
assert ipv4(address, cidr=cidr, private=is_private) is True
222+
assert isinstance(ipv4(address, cidr=cidr, private=not is_private), ValidationError)

0 commit comments

Comments
 (0)