diff options
-rw-r--r-- | branches/3144/ipaddr.py | 9 | ||||
-rwxr-xr-x | branches/3144/ipaddr_test.py | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/branches/3144/ipaddr.py b/branches/3144/ipaddr.py index 79345ce..5487d7a 100644 --- a/branches/3144/ipaddr.py +++ b/branches/3144/ipaddr.py @@ -1657,10 +1657,13 @@ class _BaseV6(object): A string, the expanded IPv6 address. """ - if isinstance(self, _BaseInterface): - ip_str = str(self.ip) - else: + if isinstance(self, IPv6Network): + ip_str = str(self.network_address) + elif isinstance(self, _BaseAddress): ip_str = str(self) + else: + # _BaseInterface + ip_str = str(self.ip) ip_int = self._ip_int_from_string(ip_str) parts = [] diff --git a/branches/3144/ipaddr_test.py b/branches/3144/ipaddr_test.py index 259d010..0239550 100755 --- a/branches/3144/ipaddr_test.py +++ b/branches/3144/ipaddr_test.py @@ -972,6 +972,7 @@ class IpaddrUnitTest(unittest.TestCase): def testExplodeShortHandIpStr(self): addr1 = ipaddr.IPv6Interface('2001::1') addr2 = ipaddr.IPv6Address('2001:0:5ef5:79fd:0:59d:a0e5:ba1') + addr3 = ipaddr.IPv6Network('2001::/96') self.assertEqual('2001:0000:0000:0000:0000:0000:0000:0001/128', addr1.exploded) self.assertEqual('0000:0000:0000:0000:0000:0000:0000:0001/128', @@ -979,6 +980,8 @@ class IpaddrUnitTest(unittest.TestCase): # issue 77 self.assertEqual('2001:0000:5ef5:79fd:0000:059d:a0e5:0ba1', addr2.exploded) + self.assertEqual('2001:0000:0000:0000:0000:0000:0000:0000/96', + addr3.exploded) def testIntRepresentation(self): self.assertEqual(16909060, int(self.ipv4)) |