diff options
author | Gian Mario Tagliaretti <gianmt@src.gnome.org> | 2008-08-02 08:25:25 +0000 |
---|---|---|
committer | Gian Mario Tagliaretti <gianmt@src.gnome.org> | 2008-08-02 08:25:25 +0000 |
commit | c5dc87ea088613158d527f5b1b1cd947db8d12b8 (patch) | |
tree | 51447b5998f92dc89651cf0a71e7272b87b46b5f /tests | |
parent | e72525344fdab47604282581fec6d7ad449c1f76 (diff) | |
download | pygobject-c5dc87ea088613158d527f5b1b1cd947db8d12b8.tar.gz pygobject-c5dc87ea088613158d527f5b1b1cd947db8d12b8.tar.xz pygobject-c5dc87ea088613158d527f5b1b1cd947db8d12b8.zip |
Wrap GFile.append_to_async with docs and test
svn path=/trunk/; revision=912
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_gio.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py index 3761b31..17642ba 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -33,6 +33,45 @@ class TestFile(unittest.TestCase): loop = glib.MainLoop() loop.run() + def testAppendToAsync(self): + self._f.write("append_to ") + self._f.close() + + def callback(file, result): + try: + stream = file.append_to_finish(result) + self.failUnless(isinstance(stream, gio.OutputStream)) + w = stream.write("testing") + cont, leng, etag = self.file.load_contents() + self.assertEqual(cont, "append_to testing") + finally: + loop.quit() + + self.file.append_to_async(callback, gio.FILE_CREATE_NONE, + glib.PRIORITY_HIGH) + + loop = glib.MainLoop() + loop.run() + + def testAppendToAsyncNoargs(self): + self._f.write("append_to ") + self._f.close() + + def callback(file, result): + try: + stream = file.append_to_finish(result) + self.failUnless(isinstance(stream, gio.OutputStream)) + w = stream.write("testing") + cont, leng, etag = self.file.load_contents() + self.assertEqual(cont, "append_to testing") + finally: + loop.quit() + + self.file.append_to_async(callback) + + loop = glib.MainLoop() + loop.run() + def testReadAsyncError(self): self.assertRaises(TypeError, self.file.read_async) self.assertRaises(TypeError, self.file.read_async, "foo", "bar") |