aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/test_streams.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2014-02-06 00:14:30 -0500
committerYury Selivanov <yselivanov@sprymix.com>2014-02-06 00:14:30 -0500
commitf0020f5d7762a73e77bc7be79251e2ebb3a4a727 (patch)
tree2a5b1e0f1a287c571c261632a846fa21241c092b /Lib/test/test_asyncio/test_streams.py
parente694c9745f2a9cbb46154e290c84c02d77066055 (diff)
downloadcpython-f0020f5d7762a73e77bc7be79251e2ebb3a4a727.tar.gz
cpython-f0020f5d7762a73e77bc7be79251e2ebb3a4a727.zip
asyncio.streams.StreamReader: Add 'at_eof()' method
Diffstat (limited to 'Lib/test/test_asyncio/test_streams.py')
-rw-r--r--Lib/test/test_asyncio/test_streams.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py
index 83474a87eee..ee3fb450291 100644
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -204,6 +204,21 @@ class StreamReaderTests(unittest.TestCase):
# expected to be empty now.
self.assertEqual(b'', stream._buffer)
+ def test_at_eof(self):
+ stream = asyncio.StreamReader(loop=self.loop)
+ self.assertFalse(stream.at_eof())
+
+ stream.feed_data(b'some data\n')
+ self.assertFalse(stream.at_eof())
+
+ self.loop.run_until_complete(stream.readline())
+ self.assertFalse(stream.at_eof())
+
+ stream.feed_data(b'some data\n')
+ stream.feed_eof()
+ self.loop.run_until_complete(stream.readline())
+ self.assertTrue(stream.at_eof())
+
def test_readline_limit(self):
# Read one line. StreamReaders are fed with data after
# their 'readline' methods are called.