summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGian Mario Tagliaretti <gianmt@gnome.org>2009-06-09 00:08:21 +0200
committerGian Mario Tagliaretti <gianmt@gnome.org>2009-06-09 00:10:09 +0200
commit407b0e909056f15960e6a4e549896d786ce0a0b2 (patch)
treebe0d917549f33fb281fa7df07c84bfe10694235a /tests
parentb7c96b41b287685fe57504e0add3a6f16e649975 (diff)
downloadpygobject-407b0e909056f15960e6a4e549896d786ce0a0b2.tar.gz
pygobject-407b0e909056f15960e6a4e549896d786ce0a0b2.tar.xz
pygobject-407b0e909056f15960e6a4e549896d786ce0a0b2.zip
Wrap gio.BufferedInputStream.fill_async
Wrap the method gio.BufferedInputStream.fill_async and add a test
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gio.py25
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()