MCPcopy Index your code
hub / github.com/RustPython/RustPython / testAddrExclude

Method testAddrExclude

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected