File tree Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,17 @@ def test_one_input(data):
20
20
21
21
try :
22
22
next (parser )
23
- except StopIteration :
24
- pass # request is available in exc.value
23
+ except StopIteration as exc :
24
+ assert isinstance (exc .value , Request )
25
+ return # input accepted
25
26
except (
26
27
EOFError , # connection is closed without a full HTTP request
27
28
SecurityError , # request exceeds a security limit
28
29
ValueError , # request isn't well formatted
29
30
):
30
- pass
31
+ return # input rejected with a documented exception
32
+
33
+ raise RuntimeError ("parsing didn't complete" )
31
34
32
35
33
36
def main ():
Original file line number Diff line number Diff line change @@ -21,15 +21,18 @@ def test_one_input(data):
21
21
)
22
22
try :
23
23
next (parser )
24
- except StopIteration :
25
- pass # response is available in exc.value
24
+ except StopIteration as exc :
25
+ assert isinstance (exc .value , Response )
26
+ return # input accepted
26
27
except (
27
28
EOFError , # connection is closed without a full HTTP response
28
29
SecurityError , # response exceeds a security limit
29
30
LookupError , # response isn't well formatted
30
31
ValueError , # response isn't well formatted
31
32
):
32
- pass
33
+ return # input rejected with a documented exception
34
+
35
+ raise RuntimeError ("parsing didn't complete" )
33
36
34
37
35
38
def main ():
Original file line number Diff line number Diff line change @@ -28,13 +28,16 @@ def test_one_input(data):
28
28
29
29
try :
30
30
next (parser )
31
- except StopIteration :
32
- pass # response is available in exc.value
31
+ except StopIteration as exc :
32
+ assert isinstance (exc .value , Frame )
33
+ return # input accepted
33
34
except (
34
35
PayloadTooBig , # frame's payload size exceeds ``max_size``
35
36
ProtocolError , # frame contains incorrect values
36
37
):
37
- pass
38
+ return # input rejected with a documented exception
39
+
40
+ raise RuntimeError ("parsing didn't complete" )
38
41
39
42
40
43
def main ():
You can’t perform that action at this time.
0 commit comments