@@ -31,7 +31,8 @@ def test_allowing_schemes():
3131def test_allowing_hosts ():
3232 """Verify the ability to select hosts to be allowed."""
3333 validator = validators .Validator ().allow_hosts (
34- "pypi.python.org" , "pypi.org" ,
34+ "pypi.python.org" ,
35+ "pypi.org" ,
3536 )
3637
3738 assert "pypi.python.org" in validator .allowed_hosts
@@ -161,7 +162,10 @@ def test_multiple_missing_components(uri):
161162
162163@pytest .mark .parametrize (
163164 "uri" ,
164- [rfc3986 .uri_reference ("smtp://" ), rfc3986 .uri_reference ("telnet://" ),],
165+ [
166+ rfc3986 .uri_reference ("smtp://" ),
167+ rfc3986 .uri_reference ("telnet://" ),
168+ ],
165169)
166170def test_ensure_uri_has_a_scheme (uri ):
167171 """Verify validation with allowed schemes."""
@@ -183,8 +187,14 @@ def test_allowed_hosts_and_schemes(uri, failed_component):
183187 """Verify each of these fails."""
184188 validator = (
185189 validators .Validator ()
186- .allow_schemes ("https" , "ssh" ,)
187- .allow_hosts ("github.com" , "git.openstack.org" ,)
190+ .allow_schemes (
191+ "https" ,
192+ "ssh" ,
193+ )
194+ .allow_hosts (
195+ "github.com" ,
196+ "git.openstack.org" ,
197+ )
188198 )
189199 with pytest .raises (exceptions .UnpermittedComponentError ) as caught_exc :
190200 validator .validate (uri )
@@ -237,11 +247,22 @@ def test_allowed_hosts_and_schemes(uri, failed_component):
237247def test_successful_complex_validation (uri ):
238248 """Verify we do not raise ValidationErrors for good URIs."""
239249 validators .Validator ().allow_schemes ("https" , "ssh" ,).allow_hosts (
240- "github.com" , "bitbucket.org" , "gitlab.com" , "git.openstack.org" ,
250+ "github.com" ,
251+ "bitbucket.org" ,
252+ "gitlab.com" ,
253+ "git.openstack.org" ,
241254 ).allow_ports ("22" , "443" ,).require_presence_of (
242- "scheme" , "host" , "path" ,
255+ "scheme" ,
256+ "host" ,
257+ "path" ,
243258 ).check_validity_of (
244- "scheme" , "userinfo" , "host" , "port" , "path" , "query" , "fragment" ,
259+ "scheme" ,
260+ "userinfo" ,
261+ "host" ,
262+ "port" ,
263+ "path" ,
264+ "query" ,
265+ "fragment" ,
245266 ).validate (
246267 uri
247268 )
@@ -259,9 +280,10 @@ def test_invalid_uri_with_invalid_path(invalid_uri):
259280 uri = rfc3986 .uri_reference (invalid_uri )
260281 uri = uri .copy_with (path = "#foobar" )
261282 with pytest .raises (exceptions .InvalidComponentsError ):
262- validators .Validator ().check_validity_of ("host" , "path" ,).validate (
263- uri
264- )
283+ validators .Validator ().check_validity_of (
284+ "host" ,
285+ "path" ,
286+ ).validate (uri )
265287
266288
267289def test_validating_rfc_4007_ipv6_zone_ids ():
0 commit comments