diff options
author | Johan Dahlin <johan@src.gnome.org> | 2008-04-11 19:30:35 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-04-11 19:30:35 +0000 |
commit | a1f9fc7c71c26d669600244f838f98205e57e2a5 (patch) | |
tree | b0e4633eaa9994365ddabcb581a2ffada2e35168 /tests | |
parent | 74ffca1fdd1a30eff58cadf766d0f4f5a504e3db (diff) | |
download | pygobject-a1f9fc7c71c26d669600244f838f98205e57e2a5.tar.gz pygobject-a1f9fc7c71c26d669600244f838f98205e57e2a5.tar.xz pygobject-a1f9fc7c71c26d669600244f838f98205e57e2a5.zip |
test TypeError of read_async/write_async properly
svn path=/trunk/; revision=774
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_gio.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py index 95d5206..e7387f1 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -32,6 +32,17 @@ class TestFile(unittest.TestCase): loop = gobject.MainLoop() loop.run() + def testReadAsyncError(self): + self.assertRaises(TypeError, self.file.read_async) + self.assertRaises(TypeError, self.file.read_async, "foo", "bar") + self.assertRaises(TypeError, self.file.read_async, "foo", + priority="bar") + self.assertRaises(TypeError, self.file.read_async, "foo", + priority="bar") + self.assertRaises(TypeError, self.file.read_async, "foo", + priority=1, cancellable="bar") + self.assertRaises(TypeError, self.file.read_async, "foo", 1, "bar") + def testConstructor(self): for gfile in [gio.File("/"), gio.File("file:///"), @@ -114,6 +125,18 @@ class TestInputStream(unittest.TestCase): self.assertEquals(self.count, 2) + self.assertRaises(TypeError, self.stream.read_async) + self.assertRaises(TypeError, self.stream.read_async, "foo") + self.assertRaises(TypeError, self.stream.read_async, 1024, "bar") + self.assertRaises(TypeError, self.stream.read_async, 1024, + priority="bar") + self.assertRaises(TypeError, self.stream.read_async, 1024, + priority="bar") + self.assertRaises(TypeError, self.stream.read_async, 1024, + priority=1, cancellable="bar") + self.assertRaises(TypeError, self.stream.read_async, 1024, 1, "bar") + + # FIXME: this makes 'make check' freeze def _testCloseAsync(self): def callback(stream, result): @@ -172,6 +195,16 @@ class TestOutputStream(unittest.TestCase): loop = gobject.MainLoop() loop.run() + self.assertRaises(TypeError, self.stream.write_async) + self.assertRaises(TypeError, self.stream.write_async, 1138) + self.assertRaises(TypeError, self.stream.write_async, "foo", "bar") + self.assertRaises(TypeError, self.stream.write_async, "foo", + priority="bar") + self.assertRaises(TypeError, self.stream.write_async, "foo", + priority="bar") + self.assertRaises(TypeError, self.stream.write_async, "foo", + priority=1, cancellable="bar") + self.assertRaises(TypeError, self.stream.write_async, "foo", 1, "bar") # FIXME: this makes 'make check' freeze def _testCloseAsync(self): |