diff options
author | Gian Mario Tagliaretti <gianmt@gnome.org> | 2009-06-01 22:40:56 +0200 |
---|---|---|
committer | Gian Mario Tagliaretti <gianmt@gnome.org> | 2009-06-01 22:40:56 +0200 |
commit | f605811afe8c91f121e89b6f9ec28c70b62f4110 (patch) | |
tree | dd7ef89422f24062d77087868468ca310c316d3f /tests | |
parent | 08623e54a426377c1504b5c364aabae5a17f8ad8 (diff) | |
download | pygobject-f605811afe8c91f121e89b6f9ec28c70b62f4110.tar.gz pygobject-f605811afe8c91f121e89b6f9ec28c70b62f4110.tar.xz pygobject-f605811afe8c91f121e89b6f9ec28c70b62f4110.zip |
Wrap gio.FileInputStream.query_async
Add the wrapper for gio.FileInputStream.query_async including docs and
a test.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_gio.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py index 2d33e8f..203f933 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -984,3 +984,30 @@ class TestVolume(unittest.TestCase): for id in ids: if id is not None: self.failUnless(isinstance(id, str)) + +class TestFileInputStream(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() + + inputstream = self.file.read() + inputstream.query_info_async("standard", callback) + + loop = glib.MainLoop() + loop.run() |