mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #14814: In the spirit of TOOWTDI, ditch the redundant version parameter to the factory functions by using the appropriate direct class references instead
This commit is contained in:
parent
072b1e1485
commit
51c3067551
2 changed files with 48 additions and 94 deletions
|
@ -780,12 +780,6 @@ class IpaddrUnitTest(unittest.TestCase):
|
|||
self.assertEqual(self.ipv4_address.version, 4)
|
||||
self.assertEqual(self.ipv6_address.version, 6)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
ipaddress.ip_address('1', version=[])
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
ipaddress.ip_address('1', version=5)
|
||||
|
||||
def testMaxPrefixLength(self):
|
||||
self.assertEqual(self.ipv4_interface.max_prefixlen, 32)
|
||||
self.assertEqual(self.ipv6_interface.max_prefixlen, 128)
|
||||
|
@ -1052,12 +1046,7 @@ class IpaddrUnitTest(unittest.TestCase):
|
|||
|
||||
def testForceVersion(self):
|
||||
self.assertEqual(ipaddress.ip_network(1).version, 4)
|
||||
self.assertEqual(ipaddress.ip_network(1, version=6).version, 6)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
ipaddress.ip_network(1, version='l')
|
||||
with self.assertRaises(ValueError):
|
||||
ipaddress.ip_network(1, version=3)
|
||||
self.assertEqual(ipaddress.IPv6Network(1).version, 6)
|
||||
|
||||
def testWithStar(self):
|
||||
self.assertEqual(str(self.ipv4_interface.with_prefixlen), "1.2.3.4/24")
|
||||
|
@ -1148,13 +1137,6 @@ class IpaddrUnitTest(unittest.TestCase):
|
|||
sixtofouraddr.sixtofour)
|
||||
self.assertFalse(bad_addr.sixtofour)
|
||||
|
||||
def testIpInterfaceVersion(self):
|
||||
with self.assertRaises(ValueError):
|
||||
ipaddress.ip_interface(1, version=123)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
ipaddress.ip_interface(1, version='')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue