File: Update-IpAddress-tests-for-Python3.9.5.patch

package info (click to toggle)
python-mkdocs 1.6.1%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,816 kB
  • sloc: python: 14,346; javascript: 10,535; perl: 143; sh: 57; makefile: 30; xml: 11
file content (34 lines) | stat: -rw-r--r-- 1,410 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From: =?utf-8?b?w4FsdmFybyBNb25kw6lqYXI=?= <mondejar1994@gmail.com>
Date: Sat, 8 May 2021 15:40:37 +0200
Subject: Update IpAddress tests for Python3.9.5

(cherry picked from commit 775d506c63d4b57553110ee56b8c1f94d336e1f7)

Forwarded: https://github.com/mkdocs/mkdocs/commit/775d506c63d4b57553110ee56b8c1f94d336e1f7
---
 mkdocs/tests/config/config_options_tests.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/mkdocs/tests/config/config_options_tests.py b/mkdocs/tests/config/config_options_tests.py
index 0f5f07d..b843c5c 100644
--- a/mkdocs/tests/config/config_options_tests.py
+++ b/mkdocs/tests/config/config_options_tests.py
@@ -361,6 +361,18 @@ class IpAddressTest(TestCase):
         self.assertEqual(conf['option'].host, '::')
         self.assertEqual(conf['option'].port, 8000)
 
+    @unittest.skipIf(
+        sys.version_info >= (3, 9, 5),
+        "Leading zeros not allowed in IP addresses since Python3.9.5",
+    )
+    def test_IP_normalization(self):
+        addr = '127.000.000.001:8000'
+        option = config_options.IpAddress(default=addr)
+        value = option.validate(None)
+        self.assertEqual(str(value), '127.0.0.1:8000')
+        self.assertEqual(value.host, '127.0.0.1')
+        self.assertEqual(value.port, 8000)
+
     @unittest.skipIf(
         sys.version_info < (3, 9, 5),
         "Leading zeros allowed in IP addresses before Python3.9.5",