def test_not_allowed(self): encoding = 'TSCII' def enc(): ''.encode(encoding) try: enc() except LookupError: pass else: raise nose.SkipTest( 'python{ver[0]}.{ver[1]} supports the {enc} encoding'.format( ver=sys.version_info, enc=encoding)) E.install_extra_encodings() with assert_raises(LookupError): enc()
def patch_environment(cls): if cls._patched_environment is not None: raise EnvironmentAlreadyPatched encinfo.install_extra_encodings() polib4us.install_patches() cls._patched_environment = True
def test_mb_decode_error(self): E.install_extra_encodings() b = self._viscii_bytes with assert_raises(UnicodeDecodeError): b.decode('EUC-TW')
def test_mb_decode(self): E.install_extra_encodings() b = self._euc_tw_bytes u = b.decode('EUC-TW') assert_equal(u, self._euc_tw_unicode)
def test_mb_encode_error(self): E.install_extra_encodings() u = self._viscii_unicode with assert_raises(UnicodeEncodeError): u.encode('EUC-TW')
def test_mb_encode(self): E.install_extra_encodings() u = self._euc_tw_unicode b = u.encode('EUC-TW') assert_equal(b, self._euc_tw_bytes)
def test_8b_decode(self): E.install_extra_encodings() b = self._viscii_bytes u = b.decode('VISCII') assert_equal(u, self._viscii_unicode)
def test_8b_encode(self): E.install_extra_encodings() u = self._viscii_unicode b = u.encode('VISCII') assert_equal(b, self._viscii_bytes)
def test_8859(self): E.install_extra_encodings() encoding = '8859-2' portable_encoding = E.propose_portable_encoding(encoding) assert_equal('ISO-' + encoding, portable_encoding)