From db07def4e878b7237a61d4ac73a861d7422a5578 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Tue, 8 Apr 2008 15:12:21 +0000 Subject: Add bindings for content_type_guess. Based on patch by Thomas Leonard 2008-04-08 Johan Dahlin * 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 --- tests/test_gio.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') 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='') + self.assertEquals('text/html', mime_type) + + def testGuessFromContentsUncertain(self): + mime_type, result_uncertain = gio.content_type_guess( + data='', want_uncertain=True) + self.assertEquals('text/html', mime_type) + self.assertEquals(bool, type(result_uncertain)) -- cgit