@@ -339,6 +339,28 @@ class Schema(Config):
339339 self .assertEqual (conf .option .host , '127.0.0.1' )
340340 self .assertEqual (conf .option .port , 8000 )
341341
342+ def test_bind_all_IPv4_address (self ):
343+ addr = '0.0.0.0:8000'
344+
345+ class Schema (Config ):
346+ option = c .IpAddress (default = addr )
347+
348+ conf = self .get_config (Schema , {'option' : None })
349+ self .assertEqual (str (conf ['option' ]), addr )
350+ self .assertEqual (conf ['option' ].host , '0.0.0.0' )
351+ self .assertEqual (conf ['option' ].port , 8000 )
352+
353+ def test_bind_all_IPv6_address (self ):
354+ addr = ':::8000'
355+
356+ class Schema (Config ):
357+ option = c .IpAddress (default = addr )
358+
359+ conf = self .get_config (Schema , {'option' : None })
360+ self .assertEqual (str (conf ['option' ]), addr )
361+ self .assertEqual (conf ['option' ].host , '::' )
362+ self .assertEqual (conf ['option' ].port , 8000 )
363+
342364 @unittest .skipIf (
343365 sys .version_info < (3 , 9 , 5 ),
344366 "Leading zeros allowed in IP addresses before Python3.9.5" ,
@@ -369,37 +391,6 @@ def test_invalid_address_missing_port(self) -> None:
369391 with self .expect_error (option = "Must be a string of format 'IP:PORT'" ):
370392 self .get_config (self .Schema , {'option' : '127.0.0.1' })
371393
372- def test_unsupported_address (self ) -> None :
373- class Schema (Config ):
374- dev_addr = c .IpAddress ()
375-
376- self .get_config (
377- Schema ,
378- {'dev_addr' : '0.0.0.0:8000' },
379- warnings = dict (
380- dev_addr = "The use of the IP address '0.0.0.0' suggests a production "
381- "environment or the use of a proxy to connect to the MkDocs "
382- "server. However, the MkDocs' server is intended for local "
383- "development purposes only. Please use a third party "
384- "production-ready server instead."
385- ),
386- )
387-
388- def test_unsupported_IPv6_address (self ) -> None :
389- class Schema (Config ):
390- dev_addr = c .IpAddress ()
391-
392- self .get_config (
393- Schema ,
394- {'dev_addr' : ':::8000' },
395- warnings = dict (
396- dev_addr = "The use of the IP address '::' suggests a production environment "
397- "or the use of a proxy to connect to the MkDocs server. However, "
398- "the MkDocs' server is intended for local development purposes "
399- "only. Please use a third party production-ready server instead."
400- ),
401- )
402-
403394
404395class URLTest (TestCase ):
405396 def test_valid_url (self ) -> None :
0 commit comments