diff options
author | Gian Mario Tagliaretti <gianmt@src.gnome.org> | 2008-07-14 21:47:31 +0000 |
---|---|---|
committer | Gian Mario Tagliaretti <gianmt@src.gnome.org> | 2008-07-14 21:47:31 +0000 |
commit | d0aaac8f4c57bb759712936a8d612f826fd87fde (patch) | |
tree | ea6b5010fe249a5b250f79f8a737be5765d7b9aa /tests | |
parent | 0220bbda1afbfb2b8e9abe1ff07b193a49cbb4d8 (diff) | |
download | pygobject-d0aaac8f4c57bb759712936a8d612f826fd87fde.tar.gz pygobject-d0aaac8f4c57bb759712936a8d612f826fd87fde.tar.xz pygobject-d0aaac8f4c57bb759712936a8d612f826fd87fde.zip |
wrap File.load_contents_async and File.load_contents_finish with docsstrings and a test
svn path=/trunk/; revision=802
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_gio.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py index 1b91d2d..7f33137 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -70,7 +70,25 @@ class TestFile(unittest.TestCase): self.assertEqual(cont, "testing load_contents") self.assertEqual(leng, 21) self.assertNotEqual(etag, '') - + + def testLoadContentsAsync(self): + self._f.write("testing load_contents_async") + self._f.seek(0) + + def callback(contents, result): + try: + cont, leng, etag = contents.load_contents_finish(result) + self.assertEqual(cont, "testing load_contents_async") + self.assertEqual(leng, 27) + self.assertNotEqual(etag, '') + finally: + loop.quit() + + canc = gio.Cancellable() + self.file.load_contents_async(callback, cancellable=canc) + + loop = gobject.MainLoop() + loop.run() class TestGFileEnumerator(unittest.TestCase): def setUp(self): |