diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2009-09-29 19:02:24 (GMT) |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-09-29 19:02:24 (GMT) |
| commit | 595ad32f59820c67c68d1732530338a79b45b810 (patch) | |
| tree | d3c52dae217996aa726e2213d764a0d21ab55273 /Lib/test/test_httplib.py | |
| parent | 941071ef79358d32d162d6203aca53dd82a37a45 (diff) | |
| download | cpython-595ad32f59820c67c68d1732530338a79b45b810.zip cpython-595ad32f59820c67c68d1732530338a79b45b810.tar.gz cpython-595ad32f59820c67c68d1732530338a79b45b810.tar.bz2 | |
Merged revisions 75137 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r75137 | antoine.pitrou | 2009-09-29 20:44:53 +0200 (mar., 29 sept. 2009) | 14 lines
[NOTE: the original bug doesn't exist in py3k but this adds Kirk's tests and fixes
another bug in the process]
Merged revisions 75134 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75134 | antoine.pitrou | 2009-09-29 19:48:18 +0200 (mar., 29 sept. 2009) | 4 lines
Issue #6790: Make it possible again to pass an `array.array` to
`httplib.HTTPConnection.send`. Patch by Kirk McDonald.
........
................
Diffstat (limited to 'Lib/test/test_httplib.py')
| -rw-r--r-- | Lib/test/test_httplib.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 2d76f7a..37cda5d 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -1,6 +1,7 @@ import errno from http import client import io +import array import socket from unittest import TestCase @@ -174,6 +175,20 @@ class BasicTest(TestCase): self.assertTrue(sock.data.startswith(expected), '%r != %r' % (sock.data[:len(expected)], expected)) + def test_send(self): + expected = b'this is a test this is only a test' + conn = client.HTTPConnection('example.com') + sock = FakeSocket(None) + conn.sock = sock + conn.send(expected) + self.assertEquals(expected, sock.data) + sock.data = b'' + conn.send(array.array('b', expected)) + self.assertEquals(expected, sock.data) + sock.data = b'' + conn.send(io.BytesIO(expected)) + self.assertEquals(expected, sock.data) + def test_chunked(self): chunked_start = ( 'HTTP/1.1 200 OK\r\n' |
