Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
79fa2b60
Commit
79fa2b60
authored
Apr 13, 2001
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for SF bug #405427
parent
23d40477
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
Lib/test/output/test_httplib
Lib/test/output/test_httplib
+5
-0
Lib/test/test_httplib.py
Lib/test/test_httplib.py
+31
-0
No files found.
Lib/test/output/test_httplib
0 → 100644
View file @
79fa2b60
test_httplib
reply: 'HTTP/1.1 200 Ok\r\n'
Text
reply: 'HTTP/1.1 400.100 Not Ok\r\n'
BadStatusLine raised as expected
Lib/test/test_httplib.py
0 → 100644
View file @
79fa2b60
from
test.test_support
import
verify
,
verbose
import
httplib
import
StringIO
class
FakeSocket
:
def
__init__
(
self
,
text
):
self
.
text
=
text
def
makefile
(
self
,
mode
,
bufsize
=
None
):
if
mode
!=
'r'
and
mode
!=
'rb'
:
raise
UnimplementedFileMode
()
return
StringIO
.
StringIO
(
self
.
text
)
# Test HTTP status lines
body
=
"HTTP/1.1 200 Ok
\
r
\
n
\
r
\
n
Text"
sock
=
FakeSocket
(
body
)
resp
=
httplib
.
HTTPResponse
(
sock
,
1
)
resp
.
begin
()
print
resp
.
read
()
resp
.
close
()
body
=
"HTTP/1.1 400.100 Not Ok
\
r
\
n
\
r
\
n
Text"
sock
=
FakeSocket
(
body
)
resp
=
httplib
.
HTTPResponse
(
sock
,
1
)
try
:
resp
.
begin
()
except
httplib
.
BadStatusLine
:
print
"BadStatusLine raised as expected"
else
:
print
"Expect BadStatusLine"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment