summaryrefslogtreecommitdiff
path: root/Lib/test/test_ipaddress.py
diff options
context:
space:
mode:
authorHumbled Drugman <humbled.drugman@gmail.com>2022-05-03 18:21:24 +0100
committerGitHub <noreply@github.com>2022-05-03 11:21:24 -0600
commitb295a92c50b128e494f47c28f12b8e9eac2927ea (patch)
treeeb7ffaf3f7bbe928a8be22a9c136b104e8f264f8 /Lib/test/test_ipaddress.py
parent77e7a04cd235f1bcd6fc69bcb15e2683c365d637 (diff)
downloadcpython-git-b295a92c50b128e494f47c28f12b8e9eac2927ea.tar.gz
bpo-29890: Test IPv*Interface construction with tuple argument (#30862)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Lib/test/test_ipaddress.py')
-rw-r--r--Lib/test/test_ipaddress.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py
index e5162e86cb..c9ae7dab38 100644
--- a/Lib/test/test_ipaddress.py
+++ b/Lib/test/test_ipaddress.py
@@ -579,6 +579,10 @@ class NetmaskTestMixin_v4(CommonTestMixin_v4):
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):
@@ -739,6 +743,10 @@ class NetmaskTestMixin_v6(CommonTestMixin_v6):
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).