Пример #1
0
    def test_create_mimetype(self):
        mt1 = Mime.MIMEtype('application', 'pdf')
        mt2 = Mime.MIMEtype('application', 'pdf')
        self.assertEqual(id(mt1), id(mt2))  # Check caching

        amr = Mime.MIMEtype('audio', 'AMR')
        self.check_mimetype(amr, 'audio', 'amr')  # Check lowercase

        ogg = Mime.MIMEtype('audio/ogg')
        self.check_mimetype(ogg, 'audio', 'ogg')  # Check split on /

        self.assertRaises(Exception, Mime.MIMEtype, 'audio/foo/bar')
Пример #2
0
 def test_get_comment(self):
     # Check these don't throw an error. One that is likely to exist:
     Mime.MIMEtype("application", "pdf").get_comment()
     # And one that's unlikely to exist:
     Mime.MIMEtype("application", "ierjg").get_comment()