summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGian Mario Tagliaretti <gianmt@gnome.org>2010-01-01 13:30:24 +0100
committerGian Mario Tagliaretti <gianmt@gnome.org>2010-01-01 13:30:24 +0100
commitca436fe7785fd24b0f0e65f2f8c9fa6478277682 (patch)
treeed7ae480a90d39f458e44a5557274dcc71c09d66 /tests
parentf72c5e451dfaeb01b3c3d9243fed2732d3620462 (diff)
downloadpygobject-ca436fe7785fd24b0f0e65f2f8c9fa6478277682.tar.gz
pygobject-ca436fe7785fd24b0f0e65f2f8c9fa6478277682.tar.xz
pygobject-ca436fe7785fd24b0f0e65f2f8c9fa6478277682.zip
Wrap gio.File.create_readwrite_async() and add a test
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gio.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py
index a9ef159..feafc70 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -92,6 +92,30 @@ class TestFile(unittest.TestCase):
loop = glib.MainLoop()
loop.run()
+ def testCreateReadWriteAsync(self):
+ def callback(file, result):
+ try:
+ iostream = file.create_readwrite_finish(result)
+ self.failUnless(isinstance(iostream, gio.FileIOStream))
+
+ ostream = iostream.get_output_stream()
+ self.failUnless(isinstance(ostream, gio.OutputStream))
+
+ w = ostream.write("testing")
+ cont, leng, etag = file.load_contents()
+ self.assertEqual(cont, "testing")
+ finally:
+ if os.path.exists('temp.txt'):
+ os.unlink("temp.txt")
+ loop.quit()
+
+ gfile = gio.File("temp.txt")
+ gfile.create_readwrite_async(callback, gio.FILE_CREATE_NONE,
+ glib.PRIORITY_HIGH)
+
+ loop = glib.MainLoop()
+ loop.run()
+
def testCreateAsyncNoargs(self):
def callback(file, result):
try: