summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGian Mario Tagliaretti <gianmt@src.gnome.org>2008-07-14 21:47:31 +0000
committerGian Mario Tagliaretti <gianmt@src.gnome.org>2008-07-14 21:47:31 +0000
commitd0aaac8f4c57bb759712936a8d612f826fd87fde (patch)
treeea6b5010fe249a5b250f79f8a737be5765d7b9aa /tests
parent0220bbda1afbfb2b8e9abe1ff07b193a49cbb4d8 (diff)
downloadpygobject-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.py20
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):