diff options
| author | Johan Dahlin <johan@gnome.org> | 2008-04-07 12:37:27 +0000 |
|---|---|---|
| committer | Johan Dahlin <johan@src.gnome.org> | 2008-04-07 12:37:27 +0000 |
| commit | 98f1db3549f7dc056f892ceec3e81d9ee7285ce1 (patch) | |
| tree | ef9d5510bd72f7a7a0e8c1c70247278dbd566550 /tests | |
| parent | 901eeaf675aece3c2ba199a1532dbe07d80b51c5 (diff) | |
| download | pygobject-98f1db3549f7dc056f892ceec3e81d9ee7285ce1.tar.gz pygobject-98f1db3549f7dc056f892ceec3e81d9ee7285ce1.tar.xz pygobject-98f1db3549f7dc056f892ceec3e81d9ee7285ce1.zip | |
Make gio.File() (calling on an interface) a factory for creating files.
2008-04-07 Johan Dahlin <johan@gnome.org>
* gio/__init__.py:
* gio/gfile.override:
* gio/gio-types.defs:
* gio/gio.override:
* tests/test_gio.py:
Make gio.File() (calling on an interface) a factory for creating
files. Add tests and a docstring.
svn path=/trunk/; revision=764
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_gio.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py index 205b312..26ff2e8 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -32,6 +32,25 @@ class TestFile(unittest.TestCase): loop = gobject.MainLoop() loop.run() + def testConstructor(self): + for gfile in [gio.File("/"), + gio.File("file:///"), + gio.File(uri="file:///"), + gio.File(path="/"), + gio.File(u"/"), + gio.File(path=u"/")]: + self.failUnless(isinstance(gfile, gio.File)) + self.assertEquals(gfile.get_path(), "/") + self.assertEquals(gfile.get_uri(), "file:///") + + def testConstructorError(self): + self.assertRaises(TypeError, gio.File) + self.assertRaises(TypeError, gio.File, 1) + self.assertRaises(TypeError, gio.File, "foo", "bar") + self.assertRaises(TypeError, gio.File, foo="bar") + self.assertRaises(TypeError, gio.File, uri=1) + self.assertRaises(TypeError, gio.File, path=1) + class TestGFileEnumerator(unittest.TestCase): def setUp(self): |
