예제 #1
0
    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()
예제 #2
0
 def patch_environment(cls):
     if cls._patched_environment is not None:
         raise EnvironmentAlreadyPatched
     encinfo.install_extra_encodings()
     polib4us.install_patches()
     cls._patched_environment = True
예제 #3
0
 def test_mb_decode_error(self):
     E.install_extra_encodings()
     b = self._viscii_bytes
     with assert_raises(UnicodeDecodeError):
         b.decode('EUC-TW')
예제 #4
0
 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)
예제 #5
0
 def test_mb_encode_error(self):
     E.install_extra_encodings()
     u = self._viscii_unicode
     with assert_raises(UnicodeEncodeError):
         u.encode('EUC-TW')
예제 #6
0
 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)
예제 #7
0
 def test_8b_decode(self):
     E.install_extra_encodings()
     b = self._viscii_bytes
     u = b.decode('VISCII')
     assert_equal(u, self._viscii_unicode)
예제 #8
0
 def test_8b_encode(self):
     E.install_extra_encodings()
     u = self._viscii_unicode
     b = u.encode('VISCII')
     assert_equal(b, self._viscii_bytes)
예제 #9
0
 def test_8859(self):
     E.install_extra_encodings()
     encoding = '8859-2'
     portable_encoding = E.propose_portable_encoding(encoding)
     assert_equal('ISO-' + encoding, portable_encoding)