Skip to content

Commit 554b28c

Browse files
committed
Adjust test for 3.10 semantics of is_private on networks
In 3.10 and below, is_private checks whether the network and broadcast address are both private. In later versions (where the test wss backported from), it checks whether they both are in the same private network. For 0.0.0.0/0, both 0.0.0.0 and 255.225.255.255 are private, but one is in 0.0.0.0/8 ("This network") and the other in 255.255.255.255/32 ("Limited broadcast").
1 parent 0740166 commit 554b28c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/test/test_ipaddress.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2283,7 +2283,7 @@ def testReservedIpv4(self):
22832283
self.assertEqual(True, ipaddress.ip_network('0.0.0.0').is_unspecified)
22842284

22852285
def testPrivateNetworks(self):
2286-
self.assertEqual(False, ipaddress.ip_network("0.0.0.0/0").is_private)
2286+
self.assertEqual(True, ipaddress.ip_network("0.0.0.0/0").is_private)
22872287
self.assertEqual(False, ipaddress.ip_network("1.0.0.0/8").is_private)
22882288

22892289
self.assertEqual(True, ipaddress.ip_network("0.0.0.0/8").is_private)

0 commit comments

Comments
 (0)