MCPcopy
hub / github.com/urllib3/urllib3 / test_wrong_protocol

Function test_wrong_protocol

test/contrib/emscripten/test_emscripten.py:137–154  ·  view source on GitHub ↗
(
    selenium_coverage: typing.Any, testserver_http: PyodideServerInfo
)

Source from the content-addressed store, hash-verified

135
136# wrong protocol / protocol error etc. should raise an exception of http.client.HTTPException
137def test_wrong_protocol(
138 selenium_coverage: typing.Any, testserver_http: PyodideServerInfo
139) -> None:
140 @run_in_pyodide # type: ignore[untyped-decorator]
141 def pyodide_test(selenium_coverage, host: str, port: int) -> None: # type: ignore[no-untyped-def]
142 import http.client
143
144 import pytest
145
146 from urllib3.connection import HTTPConnection
147
148 conn = HTTPConnection(host, port)
149 with pytest.raises(http.client.HTTPException):
150 conn.request("GET", f"http://{host}:{port}/")
151
152 pyodide_test(
153 selenium_coverage, testserver_http.http_host, testserver_http.https_port
154 )
155
156
157# wrong protocol / protocol error etc. should raise an exception of http.client.HTTPException

Callers

nothing calls this directly

Calls 1

pyodide_testFunction · 0.85

Tested by

no test coverage detected