From 180c157f2a20b7d2dd9af05bfb5f515fd23870a0 Mon Sep 17 00:00:00 2001 From: Gian Mario Tagliaretti Date: Tue, 2 Jun 2009 10:41:26 +0200 Subject: Wrap gio.FileOutputStream.query_info_async Add the wrapper for gio.FileOutputStream.query_info_async including docs and a test. --- tests/test_gio.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests') diff --git a/tests/test_gio.py b/tests/test_gio.py index 203f933..fb7360e 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -1011,3 +1011,30 @@ class TestFileInputStream(unittest.TestCase): loop = glib.MainLoop() loop.run() + +class TestFileOutputStream(unittest.TestCase): + def setUp(self): + self._f = open("file.txt", "w+") + self._f.write("testing") + self._f.seek(0) + self.file = gio.File("file.txt") + + def tearDown(self): + self._f.close() + if os.path.exists('file.txt'): + os.unlink("file.txt") + + def testQueryInfoAsync(self): + def callback(stream, result): + try: + info = stream.query_info_finish(result) + self.failUnless(isinstance(info, gio.FileInfo)) + self.failUnless(info.get_attribute_uint64("standard::size"), 7) + finally: + loop.quit() + + outputstream = self.file.append_to() + outputstream.query_info_async("standard", callback) + + loop = glib.MainLoop() + loop.run() -- cgit