summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_httplib.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2013-04-12 19:50:42 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2013-04-12 19:50:42 (GMT)
commit3042b5ebf4aee83957428870b86de394646b731c (patch)
treeb1f2fb69400e089108baa2d0b43efbe0ecb17232 /Lib/test/test_httplib.py
parent7ca49361131ddeabe584b5fa3b53250d5ce9123c (diff)
parent7b2c8bb833780a6f6a0b5480f65d27248d7b3b53 (diff)
downloadcpython-3042b5ebf4aee83957428870b86de394646b731c.zip
cpython-3042b5ebf4aee83957428870b86de394646b731c.tar.gz
cpython-3042b5ebf4aee83957428870b86de394646b731c.tar.bz2
Issue #16658: add missing return to HTTPConnection.send().
Patch by Jeff Knupp
Diffstat (limited to 'Lib/test/test_httplib.py')
-rw-r--r--Lib/test/test_httplib.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index a2f141e..b3688af 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -373,6 +373,27 @@ class BasicTest(TestCase):
conn.send(io.BytesIO(expected))
self.assertEqual(expected, sock.data)
+ def test_send_updating_file(self):
+ def data():
+ yield 'data'
+ yield None
+ yield 'data_two'
+
+ class UpdatingFile():
+ mode = 'r'
+ d = data()
+ def read(self, blocksize=-1):
+ return self.d.__next__()
+
+ expected = b'data'
+
+ conn = client.HTTPConnection('example.com')
+ sock = FakeSocket("")
+ conn.sock = sock
+ conn.send(UpdatingFile())
+ self.assertEqual(sock.data, expected)
+
+
def test_send_iter(self):
expected = b'GET /foo HTTP/1.1\r\nHost: example.com\r\n' \
b'Accept-Encoding: identity\r\nContent-Length: 11\r\n' \