def test_fixencoding(self): s = u'@charset "' self.assert_(codec._fixencoding(s, u"utf-8") is None) s = u'@charset "x' self.assert_(codec._fixencoding(s, u"utf-8") is None) s = u'@charset "x' self.assertEqual(codec._fixencoding(s, u"utf-8", True), s) s = u'@charset x' self.assertEqual(codec._fixencoding(s, u"utf-8"), s) s = u'@charset "x"' self.assertEqual(codec._fixencoding(s, u"utf-8"), s.replace('"x"', '"utf-8"'))
def test_fixencoding(self): "codec._fixencoding()" s = u'@charset "' self.assert_(codec._fixencoding(s, u"utf-8") is None) s = u'@charset "x' self.assert_(codec._fixencoding(s, u"utf-8") is None) s = u'@charset "x' self.assertEqual(codec._fixencoding(s, u"utf-8", True), s) s = u'@charset x' self.assertEqual(codec._fixencoding(s, u"utf-8"), s) s = u'@charset "x"' self.assertEqual(codec._fixencoding(s, u"utf-8"), s.replace('"x"', '"utf-8"'))