File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1480,6 +1480,10 @@ def with_hostmask(self):
14801480 def is_unspecified (self ):
14811481 return self ._ip == 0 and self .network .is_unspecified
14821482
1483+ @property
1484+ def is_loopback (self ):
1485+ return super ().is_loopback and self .network .is_loopback
1486+
14831487
14841488class IPv4Network (_BaseV4 , _BaseNetwork ):
14851489
Original file line number Diff line number Diff line change @@ -2307,6 +2307,10 @@ def testReservedIpv4(self):
23072307 self .assertFalse (ipaddress .ip_interface ('0.0.0.0/31' ).is_unspecified )
23082308 self .assertFalse (ipaddress .ip_interface ('1.2.3.4/32' ).is_unspecified )
23092309
2310+ self .assertTrue (ipaddress .ip_interface ('127.0.0.1/8' ).is_loopback )
2311+ self .assertFalse (ipaddress .ip_interface ('127.0.0.1/4' ).is_loopback )
2312+ self .assertFalse (ipaddress .ip_interface ('1.2.3.4/32' ).is_loopback )
2313+
23102314 self .assertEqual (True , ipaddress .ip_interface (
23112315 '192.168.1.1/17' ).is_private )
23122316 self .assertEqual (False , ipaddress .ip_network ('192.169.0.0' ).is_private )
You can’t perform that action at this time.
0 commit comments