From d0aaac8f4c57bb759712936a8d612f826fd87fde Mon Sep 17 00:00:00 2001 From: Gian Mario Tagliaretti Date: Mon, 14 Jul 2008 21:47:31 +0000 Subject: wrap File.load_contents_async and File.load_contents_finish with docsstrings and a test svn path=/trunk/; revision=802 --- tests/test_gio.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'tests/test_gio.py') 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): -- cgit