@pytest.mark.parametrize('qurl, tpl', [(QUrl(), None), (QUrl('qute://'), None), (QUrl('qute://foobar'), None), (QUrl('mailto:nobody'), None), (QUrl('ftp://example.com/'), ('ftp', 'example.com', 21)), (QUrl('ftp://example.com:2121/'), ('ftp', 'example.com', 2121)), (QUrl('http://qutebrowser.org:8010/waterfall'), ('http', 'qutebrowser.org', 8010)), (QUrl('https://example.com/'), ('https', 'example.com', 443)), (QUrl('https://example.com:4343/'), ('https', 'example.com', 4343)), (QUrl('http://user:password@qutebrowser.org/foo?bar=baz#fish'), ('http', 'qutebrowser.org', 80))])
def test_host_tuple(qurl, tpl):
 if (tpl is None):
  with pytest.raises(ValueError):
   urlutils.host_tuple(qurl)
 else:
  assert (urlutils.host_tuple(qurl) == tpl)

@ pytest . mark . parametrize ( 'qurl, tpl' , [ ( QUrl ( ) , None ) , ( QUrl ( 'qute://' ) , None ) , ( QUrl ( 'qute://foobar' ) , None ) , ( QUrl ( 'mailto:nobody' ) , None ) , ( QUrl ( 'ftp://example.com/' ) , ( 'ftp' , 'example.com' , 21 ) ) , ( QUrl ( 'ftp://example.com:2121/' ) , ( 'ftp' , 'example.com' , 2121 ) ) , ( QUrl ( 'http://qutebrowser.org:8010/waterfall' ) , ( 'http' , 'qutebrowser.org' , 8010 ) ) , ( QUrl ( 'https://example.com/' ) , ( 'https' , 'example.com' , 443 ) ) , ( QUrl ( 'https://example.com:4343/' ) , ( 'https' , 'example.com' , 4343 ) ) , ( QUrl ( 'http://user:password@qutebrowser.org/foo?bar=baz#fish' ) , ( 'http' , 'qutebrowser.org' , 80 ) ) ] ) def test_host_tuple ( qurl , tpl ) : if ( tpl is None ) : with pytest . raises ( ValueError ) : urlutils . host_tuple ( qurl ) else : assert ( urlutils . host_tuple ( qurl ) == tpl )
test host_tuple() .