예제 #1
0
 def test_encodingByMediaType(self):
     "encutils.encodingByMediaType"
     tests = {
         'application/xml': 'utf-8',
         'application/xml-dtd': 'utf-8',
         'application/xml-external-parsed-entity': 'utf-8',
         'application/ANYTHING+xml': 'utf-8',
         '  application/xml  ': 'utf-8',
         'text/xml': 'ascii',
         'text/xml-external-parsed-entity': 'ascii',
         'text/ANYTHING+xml': 'ascii',
         'text/html': 'iso-8859-1',
         'text/css': 'utf-8',
         'text/plain': 'iso-8859-1',
         'ANYTHING': None
     }
     for test, exp in list(tests.items()):
         self.assertEqual(exp, encutils.encodingByMediaType(test, log=log))
예제 #2
0
 def test_encodingByMediaType(self):
     "encutils.encodingByMediaType"
     tests = {
         "application/xml": "utf-8",
         "application/xml-dtd": "utf-8",
         "application/xml-external-parsed-entity": "utf-8",
         "application/ANYTHING+xml": "utf-8",
         "  application/xml  ": "utf-8",
         "text/xml": "ascii",
         "text/xml-external-parsed-entity": "ascii",
         "text/ANYTHING+xml": "ascii",
         "text/html": "iso-8859-1",
         "text/css": "utf-8",
         "text/plain": "iso-8859-1",
         "ANYTHING": None,
     }
     for test, exp in tests.items():
         self.assertEqual(exp, encutils.encodingByMediaType(test, log=log))
예제 #3
0
 def test_encodingByMediaType(self):
     "encutils.encodingByMediaType"
     tests = {
         'application/xml': 'utf-8',
         'application/xml-dtd': 'utf-8',
         'application/xml-external-parsed-entity': 'utf-8',
         'application/ANYTHING+xml': 'utf-8',
         '  application/xml  ': 'utf-8',
         'text/xml': 'ascii',
         'text/xml-external-parsed-entity': 'ascii',
         'text/ANYTHING+xml': 'ascii',
         'text/html': 'iso-8859-1',
         'text/css': 'utf-8',
         'text/plain': 'iso-8859-1',
         'ANYTHING': None
         }
     for test, exp in list(tests.items()):
         self.assertEqual(exp,
                          encutils.encodingByMediaType(test, log=log))