summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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))