77 ConnectionClosed ,
88 Data ,
99 EndOfMessage ,
10- Event ,
1110 InformationalResponse ,
1211 Request ,
1312 Response ,
1716 CLOSED ,
1817 DONE ,
1918 ERROR ,
20- IDLE ,
2119 MIGHT_SWITCH_PROTOCOL ,
2220 MUST_CLOSE ,
2321 SEND_BODY ,
@@ -48,15 +46,15 @@ def test__keep_alive() -> None:
4846 )
4947 )
5048 assert not _keep_alive (
51- Request (method = "GET" , target = "/" , headers = [], http_version = "1.0" ) # type: ignore[arg-type]
49+ Request (method = "GET" , target = "/" , headers = [], http_version = "1.0" )
5250 )
5351
54- assert _keep_alive (Response (status_code = 200 , headers = [])) # type: ignore[arg-type]
52+ assert _keep_alive (Response (status_code = 200 , headers = []))
5553 assert not _keep_alive (Response (status_code = 200 , headers = [("Connection" , "close" )]))
5654 assert not _keep_alive (
5755 Response (status_code = 200 , headers = [("Connection" , "a, b, cLOse, foo" )])
5856 )
59- assert not _keep_alive (Response (status_code = 200 , headers = [], http_version = "1.0" )) # type: ignore[arg-type]
57+ assert not _keep_alive (Response (status_code = 200 , headers = [], http_version = "1.0" ))
6058
6159
6260def test__body_framing () -> None :
@@ -135,7 +133,7 @@ def test_Connection_basics_and_content_length() -> None:
135133 assert p .conn [CLIENT ].their_http_version is None
136134 assert p .conn [SERVER ].their_http_version == b"1.1"
137135
138- data = p .send (SERVER , InformationalResponse (status_code = 100 , headers = [])) # type: ignore[arg-type]
136+ data = p .send (SERVER , InformationalResponse (status_code = 100 , headers = []))
139137 assert data == b"HTTP/1.1 100 \r \n \r \n "
140138
141139 data = p .send (SERVER , Response (status_code = 200 , headers = [("Content-Length" , "11" )]))
@@ -247,7 +245,7 @@ def test_client_talking_to_http10_server() -> None:
247245 assert c .our_state is DONE
248246 # No content-length, so Http10 framing for body
249247 assert receive_and_get (c , b"HTTP/1.0 200 OK\r \n \r \n " ) == [
250- Response (status_code = 200 , headers = [], http_version = "1.0" , reason = b"OK" ) # type: ignore[arg-type]
248+ Response (status_code = 200 , headers = [], http_version = "1.0" , reason = b"OK" )
251249 ]
252250 assert c .our_state is MUST_CLOSE
253251 assert receive_and_get (c , b"12345" ) == [Data (data = b"12345" )]
@@ -261,14 +259,14 @@ def test_server_talking_to_http10_client() -> None:
261259 # No content-length, so no body
262260 # NB: no host header
263261 assert receive_and_get (c , b"GET / HTTP/1.0\r \n \r \n " ) == [
264- Request (method = "GET" , target = "/" , headers = [], http_version = "1.0" ), # type: ignore[arg-type]
262+ Request (method = "GET" , target = "/" , headers = [], http_version = "1.0" ),
265263 EndOfMessage (),
266264 ]
267265 assert c .their_state is MUST_CLOSE
268266
269267 # We automatically Connection: close back at them
270268 assert (
271- c .send (Response (status_code = 200 , headers = [])) # type: ignore[arg-type]
269+ c .send (Response (status_code = 200 , headers = []))
272270 == b"HTTP/1.1 200 \r \n Connection: close\r \n \r \n "
273271 )
274272
@@ -356,7 +354,7 @@ def test_automagic_connection_close_handling() -> None:
356354 p .send (
357355 SERVER ,
358356 # no header here...
359- [Response (status_code = 204 , headers = []), EndOfMessage ()], # type: ignore[arg-type]
357+ [Response (status_code = 204 , headers = []), EndOfMessage ()],
360358 # ...but oh look, it arrived anyway
361359 expect = [
362360 Response (status_code = 204 , headers = [("connection" , "close" )]),
@@ -390,7 +388,7 @@ def setup() -> ConnectionPair:
390388
391389 # Disabled by 100 Continue
392390 p = setup ()
393- p .send (SERVER , InformationalResponse (status_code = 100 , headers = [])) # type: ignore[arg-type]
391+ p .send (SERVER , InformationalResponse (status_code = 100 , headers = []))
394392 for conn in p .conns :
395393 assert not conn .client_is_waiting_for_100_continue
396394 assert not conn .they_are_waiting_for_100_continue
@@ -471,7 +469,7 @@ def test_max_incomplete_event_size_countermeasure() -> None:
471469 # Even more data comes in, still no problem
472470 c .receive_data (b"X" * 1000 )
473471 # We can respond and reuse to get the second pipelined request
474- c .send (Response (status_code = 200 , headers = [])) # type: ignore[arg-type]
472+ c .send (Response (status_code = 200 , headers = []))
475473 c .send (EndOfMessage ())
476474 c .start_next_cycle ()
477475 assert get_all_events (c ) == [
@@ -481,7 +479,7 @@ def test_max_incomplete_event_size_countermeasure() -> None:
481479 # But once we unpause and try to read the next message, and find that it's
482480 # incomplete and the buffer is *still* way too large, then *that's* a
483481 # problem:
484- c .send (Response (status_code = 200 , headers = [])) # type: ignore[arg-type]
482+ c .send (Response (status_code = 200 , headers = []))
485483 c .send (EndOfMessage ())
486484 c .start_next_cycle ()
487485 with pytest .raises (RemoteProtocolError ):
@@ -547,7 +545,7 @@ def test_pipelining() -> None:
547545
548546 assert c .next_event () is PAUSED
549547
550- c .send (Response (status_code = 200 , headers = [])) # type: ignore[arg-type]
548+ c .send (Response (status_code = 200 , headers = []))
551549 c .send (EndOfMessage ())
552550 assert c .their_state is DONE
553551 assert c .our_state is DONE
@@ -564,7 +562,7 @@ def test_pipelining() -> None:
564562 EndOfMessage (),
565563 ]
566564 assert c .next_event () is PAUSED
567- c .send (Response (status_code = 200 , headers = [])) # type: ignore[arg-type]
565+ c .send (Response (status_code = 200 , headers = []))
568566 c .send (EndOfMessage ())
569567 c .start_next_cycle ()
570568
@@ -574,7 +572,7 @@ def test_pipelining() -> None:
574572 ]
575573 # Doesn't pause this time, no trailing data
576574 assert c .next_event () is NEED_DATA
577- c .send (Response (status_code = 200 , headers = [])) # type: ignore[arg-type]
575+ c .send (Response (status_code = 200 , headers = []))
578576 c .send (EndOfMessage ())
579577
580578 # Arrival of more data triggers pause
@@ -683,7 +681,7 @@ def setup() -> ConnectionPair:
683681 sc .send (EndOfMessage ())
684682 sc .start_next_cycle ()
685683 assert get_all_events (sc ) == [
686- Request (method = "GET" , target = "/" , headers = [], http_version = "1.0" ), # type: ignore[arg-type]
684+ Request (method = "GET" , target = "/" , headers = [], http_version = "1.0" ),
687685 EndOfMessage (),
688686 ]
689687
@@ -845,7 +843,7 @@ def test_pipelined_close() -> None:
845843 EndOfMessage (),
846844 ]
847845 assert c .states [CLIENT ] is DONE
848- c .send (Response (status_code = 200 , headers = [])) # type: ignore[arg-type]
846+ c .send (Response (status_code = 200 , headers = []))
849847 c .send (EndOfMessage ())
850848 assert c .states [SERVER ] is DONE
851849 c .start_next_cycle ()
@@ -860,7 +858,7 @@ def test_pipelined_close() -> None:
860858 ConnectionClosed (),
861859 ]
862860 assert c .states == {CLIENT : CLOSED , SERVER : SEND_RESPONSE }
863- c .send (Response (status_code = 200 , headers = [])) # type: ignore[arg-type]
861+ c .send (Response (status_code = 200 , headers = []))
864862 c .send (EndOfMessage ())
865863 assert c .states == {CLIENT : CLOSED , SERVER : MUST_CLOSE }
866864 c .send (ConnectionClosed ())
@@ -919,7 +917,7 @@ def test_errors() -> None:
919917 # But we can still yell at the client for sending us gibberish
920918 if role is SERVER :
921919 assert (
922- c .send (Response (status_code = 400 , headers = [])) # type: ignore[arg-type]
920+ c .send (Response (status_code = 400 , headers = []))
923921 == b"HTTP/1.1 400 \r \n Connection: close\r \n \r \n "
924922 )
925923
@@ -946,8 +944,8 @@ def conn(role: Type[Sentinel]) -> Connection:
946944 http_version = "1.0" ,
947945 )
948946 elif role is SERVER :
949- good = Response (status_code = 200 , headers = []) # type: ignore[arg-type, assignment]
950- bad = Response (status_code = 200 , headers = [], http_version = "1.0" ) # type: ignore[arg-type, assignment]
947+ good = Response (status_code = 200 , headers = []) # type: ignore[assignment]
948+ bad = Response (status_code = 200 , headers = [], http_version = "1.0" ) # type: ignore[assignment]
951949 # Make sure 'good' actually is good
952950 c = conn (role )
953951 c .send (good )
@@ -1063,14 +1061,14 @@ def setup(method: bytes, http_version: bytes) -> Connection:
10631061 # No Content-Length, HTTP/1.1 peer, should use chunked
10641062 c = setup (method , b"1.1" )
10651063 assert (
1066- c .send (Response (status_code = 200 , headers = [])) == b"HTTP/1.1 200 \r \n " # type: ignore[arg-type]
1064+ c .send (Response (status_code = 200 , headers = [])) == b"HTTP/1.1 200 \r \n "
10671065 b"Transfer-Encoding: chunked\r \n \r \n "
10681066 )
10691067
10701068 # No Content-Length, HTTP/1.0 peer, frame with connection: close
10711069 c = setup (method , b"1.0" )
10721070 assert (
1073- c .send (Response (status_code = 200 , headers = [])) == b"HTTP/1.1 200 \r \n " # type: ignore[arg-type]
1071+ c .send (Response (status_code = 200 , headers = [])) == b"HTTP/1.1 200 \r \n "
10741072 b"Connection: close\r \n \r \n "
10751073 )
10761074
0 commit comments