From 407b0e909056f15960e6a4e549896d786ce0a0b2 Mon Sep 17 00:00:00 2001 From: Gian Mario Tagliaretti Date: Tue, 9 Jun 2009 00:08:21 +0200 Subject: Wrap gio.BufferedInputStream.fill_async Wrap the method gio.BufferedInputStream.fill_async and add a test --- tests/test_gio.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests') diff --git a/tests/test_gio.py b/tests/test_gio.py index de5409f..1578d58 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -1042,3 +1042,28 @@ class TestFileOutputStream(unittest.TestCase): loop = glib.MainLoop() loop.run() + +class TestBufferedInputStream(unittest.TestCase): + def setUp(self): + self._f = open("buffer.txt", "w+") + self._f.write("testing") + self._f.seek(0) + stream = gio.unix.InputStream(self._f.fileno(), False) + self.buffered = gio.BufferedInputStream(stream) + + def tearDown(self): + self._f.close() + os.unlink("buffer.txt") + + def test_fill_async(self): + def callback(stream, result): + try: + size = stream.fill_finish(result) + self.failUnlessEqual(size, 4) + finally: + loop.quit() + + self.buffered.fill_async(4, callback) + + loop = glib.MainLoop() + loop.run() -- cgit