merge heads

This commit is contained in:
Sandro Tosi 2012-06-01 20:25:36 +02:00
commit be1bc8c410
2 changed files with 12 additions and 5 deletions

View File

@ -359,7 +359,7 @@ def collapse_addresses(addresses):
else:
if nets and nets[-1]._version != ip._version:
raise TypeError("%s and %s are not of the same version" % (
str(ip), str(ips[-1])))
str(ip), str(nets[-1])))
nets.append(ip)
# sort and dedup

View File

@ -596,10 +596,17 @@ class IpaddrUnitTest(unittest.TestCase):
self.assertEqual(list(collapsed), [ip3])
# the toejam test
ip1 = ipaddress.ip_address('1.1.1.1')
ip2 = ipaddress.ip_address('::1')
self.assertRaises(TypeError, ipaddress.collapse_addresses,
[ip1, ip2])
addr_tuples = [
(ipaddress.ip_address('1.1.1.1'),
ipaddress.ip_address('::1')),
(ipaddress.IPv4Network('1.1.0.0/24'),
ipaddress.IPv6Network('2001::/120')),
(ipaddress.IPv4Network('1.1.0.0/32'),
ipaddress.IPv6Network('2001::/128')),
]
for ip1, ip2 in addr_tuples:
self.assertRaises(TypeError, ipaddress.collapse_addresses,
[ip1, ip2])
def testSummarizing(self):
#ip = ipaddress.ip_address