diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2015-01-19 00:41:32 +0200 |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-01-19 00:41:32 +0200 |
| commit | b53f0fbf96ec0b1f9ad7ddad5e9480d17e48e27a (patch) | |
| tree | 80bcc8ef0106a6379e3a646984ca622771cacfe7 /Lib/test/test_ipaddress.py | |
| parent | 1202a4733e6ffbf3149425aae14f7c4eeeb115c0 (diff) | |
| download | cpython-git-b53f0fbf96ec0b1f9ad7ddad5e9480d17e48e27a.tar.gz | |
Issue #23266: Restore the performance of ipaddress.collapse_addresses() whith
duplicated addresses and simplify the code.
Diffstat (limited to 'Lib/test/test_ipaddress.py')
| -rw-r--r-- | Lib/test/test_ipaddress.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py index 95518af23d..5ec2cd45fe 100644 --- a/Lib/test/test_ipaddress.py +++ b/Lib/test/test_ipaddress.py @@ -790,11 +790,15 @@ class IpaddrUnitTest(unittest.TestCase): 2 ** ipaddress.IPV6LENGTH) def testInternals(self): - first, last, nitems = ipaddress._find_address_range([ - ipaddress.IPv4Address('10.10.10.10'), - ipaddress.IPv4Address('10.10.10.12')]) - self.assertEqual(first, last) - self.assertEqual(nitems, 1) + ip1 = ipaddress.IPv4Address('10.10.10.10') + ip2 = ipaddress.IPv4Address('10.10.10.11') + ip3 = ipaddress.IPv4Address('10.10.10.12') + self.assertEqual(list(ipaddress._find_address_range([ip1])), + [(ip1, ip1)]) + self.assertEqual(list(ipaddress._find_address_range([ip1, ip3])), + [(ip1, ip1), (ip3, ip3)]) + self.assertEqual(list(ipaddress._find_address_range([ip1, ip2, ip3])), + [(ip1, ip3)]) self.assertEqual(128, ipaddress._count_righthand_zero_bits(0, 128)) self.assertEqual("IPv4Network('1.2.3.0/24')", repr(self.ipv4_network)) |
