def test_detect_encoding7(self): """ Test with iso-8859-15 .mo file. """ self.assertEqual( polib.detect_encoding('tests/test_iso-8859-15.mo', True), 'ISO_8859-15')
def test_detect_encoding4(self): """ Test with utf8 data (no file). """ # if polib.PY3: f = open('tests/test_utf8.po', 'rb') data = str(f.read(), 'utf-8') # else: # f = open('tests/test_utf8.po', 'r') # data = f.read() try: self.assertEqual(polib.detect_encoding(data), 'UTF-8') finally: f.close()
def test_detect_encoding5(self): """ Test with utf8 .mo file. """ self.assertEqual(polib.detect_encoding('tests/test_utf8.mo', True), 'UTF-8')
def test_detect_encoding3(self): """ Test with an utf8 .po file. """ self.assertEqual(polib.detect_encoding('tests/test_utf8.po'), 'UTF-8')
def test_detect_encoding2(self): """ Test with a .pot file. """ self.assertEqual(polib.detect_encoding('tests/test_merge.pot'), 'utf-8')
def test_detect_encoding1(self): """ Test that given encoding is returned when file has no encoding defined. """ self.assertEqual(polib.detect_encoding('tests/test_noencoding.po'), 'utf-8')