summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2008-01-20 01:20:51 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-01-20 01:20:51 +0000
commite6d7181ababaa9f08602c48e03d6557ddb6a4deb (patch)
tree0e1b33052213fae6413348232bed2b856d9c5920 /tests
parentab1ac2f37f6ae5b195ebfb20b1895e841d59e2d7 (diff)
downloadpygobject-e6d7181ababaa9f08602c48e03d6557ddb6a4deb.tar.gz
pygobject-e6d7181ababaa9f08602c48e03d6557ddb6a4deb.tar.xz
pygobject-e6d7181ababaa9f08602c48e03d6557ddb6a4deb.zip
Reorganize tests and make them test more useful things
svn path=/trunk/; revision=738
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gio.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py
index 696a80a..fb41e51 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -18,14 +18,25 @@ class TestInputStream(unittest.TestCase):
self._f.close()
os.unlink("inputstream.txt")
- def testWrite(self):
+ def testRead(self):
self.assertEquals(self.stream.read(), "testing")
+ def testReadAsync(self):
+ def callback(stream, result):
+ self.assertEquals(stream.read_finish(result), len("testing"))
+ loop.quit()
+
+ self.stream.read_async(10240, 0, None, callback)
+
+ loop = gobject.MainLoop()
+ loop.run()
+
class TestOutputStream(unittest.TestCase):
def setUp(self):
self._f = open("outputstream.txt", "w")
self.stream = gio.unix.OutputStream(self._f.fileno(), False)
+ self._f.flush()
def tearDown(self):
self._f.close()
@@ -37,13 +48,3 @@ class TestOutputStream(unittest.TestCase):
self.failUnless(os.path.exists("outputstream.txt"))
self.assertEquals(open("outputstream.txt").read(), "testing")
- def testWriteAsync(self):
- def callback(stream, result):
- loop.quit()
-
- f = gio.file_new_for_path("outputstream.txt")
- stream = f.read()
- stream.read_async(10240, 0, None, callback)
-
- loop = gobject.MainLoop()
- loop.run()