mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
bpo-29890: Test IPv*Interface construction with tuple argument (GH-30862)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit b295a92c50)
Co-authored-by: Humbled Drugman <humbled.drugman@gmail.com>
This commit is contained in:
parent
58f2d2d10a
commit
30681d6655
2 changed files with 10 additions and 0 deletions
|
|
@ -580,6 +580,10 @@ def assertBadAddress(addr, details):
|
|||
assertBadAddress("1.2.3.256", re.escape("256 (> 255)"))
|
||||
|
||||
def test_valid_netmask(self):
|
||||
self.assertEqual(str(self.factory(('192.0.2.0', 24))), '192.0.2.0/24')
|
||||
self.assertEqual(str(self.factory(('192.0.2.0', '24'))), '192.0.2.0/24')
|
||||
self.assertEqual(str(self.factory(('192.0.2.0', '255.255.255.0'))),
|
||||
'192.0.2.0/24')
|
||||
self.assertEqual(str(self.factory('192.0.2.0/255.255.255.0')),
|
||||
'192.0.2.0/24')
|
||||
for i in range(0, 33):
|
||||
|
|
@ -740,6 +744,10 @@ def assertBadAddress(addr, details):
|
|||
def test_valid_netmask(self):
|
||||
# We only support CIDR for IPv6, because expanded netmasks are not
|
||||
# standard notation.
|
||||
self.assertEqual(str(self.factory(('2001:db8::', 32))),
|
||||
'2001:db8::/32')
|
||||
self.assertEqual(str(self.factory(('2001:db8::', '32'))),
|
||||
'2001:db8::/32')
|
||||
self.assertEqual(str(self.factory('2001:db8::/32')), '2001:db8::/32')
|
||||
for i in range(0, 129):
|
||||
# Generate and re-parse the CIDR format (trivial).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue