summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandro Tosi <sandro.tosi@gmail.com>2012-06-01 18:25:36 (GMT)
committerSandro Tosi <sandro.tosi@gmail.com>2012-06-01 18:25:36 (GMT)
commitbe1bc8c41027ddbc9cb8b112dff5664aa02a631a (patch)
tree4c6750a5d057003975a97d028f1d894116c1d894
parentc10584a0d919d60e4b222bb72830a2695219b4c9 (diff)
parent35db513187a6150978f6a7355d3bd42f1a8b54e5 (diff)
downloadcpython-be1bc8c41027ddbc9cb8b112dff5664aa02a631a.zip
cpython-be1bc8c41027ddbc9cb8b112dff5664aa02a631a.tar.gz
cpython-be1bc8c41027ddbc9cb8b112dff5664aa02a631a.tar.bz2
merge heads
-rw-r--r--Lib/ipaddress.py2
-rw-r--r--Lib/test/test_ipaddress.py15
2 files changed, 12 insertions, 5 deletions
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index 7df9f20..6763517 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -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
diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py
index fd6c38c..aff4ff9 100644
--- a/Lib/test/test_ipaddress.py
+++ b/Lib/test/test_ipaddress.py
@@ -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