diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_gio.py | 25 |
1 files changed, 25 insertions, 0 deletions
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() |