def test_guesstype(self): entry = GopherEntry('/NONEXISTANT', self.config) expected = {'text/plain': '0', 'application/gopher-menu': '1', 'application/gopher+-menu' : '1', 'text/html' : 'h', 'image/gif' : 'g', 'image/jpeg' : 'I', 'application/pdf' : '9', 'application/msword' : '9', 'audio/aiff' : 's'} for mimetype, type in expected.items(): entry.mimetype = mimetype self.assertEqual(entry.guesstype(), type, "Failure for %s: got %s, expected %s" % \ (mimetype, entry.guesstype(), type))
def test_guesstype(self): entry = GopherEntry("/NONEXISTANT", self.config) expected = { "text/plain": "0", "application/gopher-menu": "1", "application/gopher+-menu": "1", "text/html": "h", "image/gif": "g", "image/jpeg": "I", "application/pdf": "9", "application/msword": "9", "audio/aiff": "s", } for mimetype, type_ in list(expected.items()): entry.mimetype = mimetype self.assertEqual( entry.guesstype(), type_, "Failure for %s: got %s, expected %s" % (mimetype, entry.guesstype(), type_), )