def testGuessEncoding(self): self.assertEquals(guessEncoding(join(DATADIR, 'utf8.txt')), 'UTF-8') self.assertEquals(guessEncoding(join(DATADIR, 'utf16.txt')), 'UTF-16') # self.assertEquals(guessEncoding(join(DATADIR, 'utf16be.txt')), 'UTF-16') self.assertEquals(guessEncoding(join(DATADIR, 'utf32.txt')), 'UTF-32') # self.assertEquals(guessEncoding(join(DATADIR, 'utf32be.txt')), 'UTF-32') self.assertEquals(guessEncoding(join(DATADIR, 'latin1.xml')), 'ISO-8859-1') self.assertEquals(guessEncoding(join(DATADIR, 'utf8.xml')), 'UTF-8') self.assertEquals(guessEncoding(join(DATADIR, 'latin1.xml')), 'ISO-8859-1') self.assertEquals(guessEncoding(join(DATADIR, 'encoded.html')), 'ISO-8859-1')
def test_guessEncodingRawUTF8Text(self): filename = join(DATADIR, 'guess_encoding.txt') enc = guessEncoding(filename) self.assertEquals(enc, 'UTF-8')