summaryrefslogtreecommitdiffstats
path: root/tests/test_gio.py
diff options
context:
space:
mode:
authorJohan Dahlin <jdahlin@async.com.br>2008-04-08 15:12:21 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-04-08 15:12:21 +0000
commitdb07def4e878b7237a61d4ac73a861d7422a5578 (patch)
tree8df21656100f9b11bb9ab4d9c2a681cf6da8fd18 /tests/test_gio.py
parent24d6e7c51d6a43a31838065ea7bb7d664f53e4d4 (diff)
downloadpygobject-db07def4e878b7237a61d4ac73a861d7422a5578.tar.gz
pygobject-db07def4e878b7237a61d4ac73a861d7422a5578.tar.xz
pygobject-db07def4e878b7237a61d4ac73a861d7422a5578.zip
Add bindings for content_type_guess. Based on patch by Thomas Leonard
2008-04-08 Johan Dahlin <jdahlin@async.com.br> * gio/gio.defs: * gio/gio.override: * tests/test_gio.py: Add bindings for content_type_guess. Based on patch by Thomas Leonard (#525113) svn path=/trunk/; revision=768
Diffstat (limited to 'tests/test_gio.py')
-rw-r--r--tests/test_gio.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py
index 2b8e9f1..b70f9c2 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -212,3 +212,18 @@ class TestThemedIcon(unittest.TestCase):
self.assertEquals(self.icon.get_names(), ['open'])
self.icon.append_name('close')
self.assertEquals(self.icon.get_names(), ['open', 'close'])
+
+class TestType(unittest.TestCase):
+ def testGuessFromName(self):
+ mime_type = gio.content_type_guess('diagram.svg')
+ self.assertEquals('image/svg+xml', mime_type)
+
+ def testGuessFromContents(self):
+ mime_type = gio.content_type_guess(data='<html></html>')
+ self.assertEquals('text/html', mime_type)
+
+ def testGuessFromContentsUncertain(self):
+ mime_type, result_uncertain = gio.content_type_guess(
+ data='<html></html>', want_uncertain=True)
+ self.assertEquals('text/html', mime_type)
+ self.assertEquals(bool, type(result_uncertain))