summaryrefslogtreecommitdiffstats
path: root/tests/test_gio.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_gio.py')
-rw-r--r--tests/test_gio.py27
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()