From: Omri Bahumi Date: Thu, 28 Feb 2013 17:49:50 +0000 (+0200) Subject: Added test_streaming_callback_with_data_in_buffer to iostream_test.py X-Git-Tag: v3.0.0~83^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abaecb033e725b08c1c9d004aa3c44c2bee021b8;p=thirdparty%2Ftornado.git Added test_streaming_callback_with_data_in_buffer to iostream_test.py --- diff --git a/tornado/test/iostream_test.py b/tornado/test/iostream_test.py index 79a2b730e..bb4796d6f 100644 --- a/tornado/test/iostream_test.py +++ b/tornado/test/iostream_test.py @@ -145,6 +145,22 @@ class TestIOStreamMixin(object): listener.close() return streams + def test_streaming_callback_with_data_in_buffer(self): + server, client = self.make_iostream_pair() + client.write("abcd\r\nefgh") + server.read_until("\r\n", self.stop) + data = self.wait() + self.assertEqual(data, "abcd\r\n") + def closed_callback(chunk): + self.fail() + server.read_until_close(callback=closed_callback, + streaming_callback=self.stop) + self.io_loop.add_timeout(self.io_loop.time() + 0.01, self.stop) + data = self.wait() + self.assertEqual(data, "efgh") + server.close() + client.close() + def test_write_zero_bytes(self): # Attempting to write zero bytes should run the callback without # going into an infinite loop.