@@ -1138,17 +1138,29 @@ def test_autorooted(self):
11381138 self .assertEqual (normal_absolute .rooted , True )
11391139 self .assertEqual (attempt_unrooted_absolute .rooted , True )
11401140
1141- def test_rooted_with_empty_non_none_host (self ):
1141+ def test_rooted_with_port_but_no_host (self ):
11421142 # type: () -> None
11431143 """
1144- The C{rooted} constructor argument will be ignored on URLs that include
1145- a scheme.
1144+ URLs which include a netloc separator are inherently rooted, regardless
1145+ of whether they include one because they specify an explicit host or
1146+ port, whether they are parsed or directly constructed, and whether the
1147+ ``rooted`` constructor argument is supplied or not.
11461148 """
1147- directly_constructed = URL (scheme = 'udp' , port = 4900 )
1149+ directly_constructed = URL (scheme = 'udp' , port = 4900 , rooted = False )
1150+ directly_constructed_implict = URL (scheme = 'udp' , port = 4900 )
1151+ directly_constructed_rooted = URL (scheme = u'udp' , port = 4900 , rooted = True )
1152+ self .assertEqual (directly_constructed .rooted , True )
1153+ self .assertEqual (directly_constructed_implict .rooted , True )
1154+ self .assertEqual (directly_constructed_rooted .rooted , True )
11481155 parsed = URL .from_text ('udp://:4900' )
11491156 self .assertEqual (str (directly_constructed ), str (parsed ))
1157+ self .assertEqual (str (directly_constructed_implict ), str (parsed ))
11501158 self .assertEqual (directly_constructed .asText (), parsed .asText ())
11511159 self .assertEqual (directly_constructed , parsed )
1160+ self .assertEqual (directly_constructed , directly_constructed_implict )
1161+ self .assertEqual (directly_constructed , directly_constructed_rooted )
1162+ self .assertEqual (directly_constructed_implict , parsed )
1163+ self .assertEqual (directly_constructed_rooted , parsed )
11521164
11531165 def test_wrong_constructor (self ):
11541166 # type: () -> None
0 commit comments