summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_ipaddress.py8
-rw-r--r--Misc/NEWS.d/next/Tests/2022-01-24-21-31-09.bpo-29890.zEG-ra.rst2
2 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py
index e5162e8..c9ae7da 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).
diff --git a/Misc/NEWS.d/next/Tests/2022-01-24-21-31-09.bpo-29890.zEG-ra.rst b/Misc/NEWS.d/next/Tests/2022-01-24-21-31-09.bpo-29890.zEG-ra.rst
new file mode 100644
index 0000000..38a06a2
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2022-01-24-21-31-09.bpo-29890.zEG-ra.rst
@@ -0,0 +1,2 @@
+Add tests for :class:`ipaddress.IPv4Interface` and :class:`ipaddress.IPv6Interface` construction with tuple arguments.
+Original patch and tests by louisom.