MCPcopy Index your code
hub / github.com/python/cpython / testAddrExclude

Method testAddrExclude

Lib/test/test_ipaddress.py:2561–2583  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2559 '::ffff:128.0.0.0').is_loopback)
2560
2561 def testAddrExclude(self):
2562 addr1 = ipaddress.ip_network('10.1.1.0/24')
2563 addr2 = ipaddress.ip_network('10.1.1.0/26')
2564 addr3 = ipaddress.ip_network('10.2.1.0/24')
2565 addr4 = ipaddress.ip_address('10.1.1.0')
2566 addr5 = ipaddress.ip_network('2001:db8::0/32')
2567 addr6 = ipaddress.ip_network('10.1.1.5/32')
2568 self.assertEqual(sorted(list(addr1.address_exclude(addr2))),
2569 [ipaddress.ip_network('10.1.1.64/26'),
2570 ipaddress.ip_network('10.1.1.128/25')])
2571 self.assertRaises(ValueError, list, addr1.address_exclude(addr3))
2572 self.assertRaises(TypeError, list, addr1.address_exclude(addr4))
2573 self.assertRaises(TypeError, list, addr1.address_exclude(addr5))
2574 self.assertEqual(list(addr1.address_exclude(addr1)), [])
2575 self.assertEqual(sorted(list(addr1.address_exclude(addr6))),
2576 [ipaddress.ip_network('10.1.1.0/30'),
2577 ipaddress.ip_network('10.1.1.4/32'),
2578 ipaddress.ip_network('10.1.1.6/31'),
2579 ipaddress.ip_network('10.1.1.8/29'),
2580 ipaddress.ip_network('10.1.1.16/28'),
2581 ipaddress.ip_network('10.1.1.32/27'),
2582 ipaddress.ip_network('10.1.1.64/26'),
2583 ipaddress.ip_network('10.1.1.128/25')])
2584
2585 def testHash(self):
2586 self.assertEqual(hash(ipaddress.ip_interface('10.1.1.0/24')),

Callers

nothing calls this directly

Calls 4

listClass · 0.85
address_excludeMethod · 0.80
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected