home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 July / maximum-cd-2011-07.iso / DiscContents / LibO_3.3.2_Win_x86_install_multi.exe / libreoffice1.cab / test_codecencodings_hk.py < prev    next >
Encoding:
Python Source  |  2011-03-15  |  808 b   |  28 lines

  1. #!/usr/bin/env python
  2. #
  3. # test_codecencodings_hk.py
  4. #   Codec encoding tests for HongKong encodings.
  5. #
  6.  
  7. from test import test_support
  8. from test import test_multibytecodec_support
  9. import unittest
  10.  
  11. class Test_Big5HKSCS(test_multibytecodec_support.TestBase, unittest.TestCase):
  12.     encoding = 'big5hkscs'
  13.     tstring = test_multibytecodec_support.load_teststring('big5hkscs')
  14.     codectests = (
  15.         # invalid bytes
  16.         ("abc\x80\x80\xc1\xc4", "strict",  None),
  17.         ("abc\xc8", "strict",  None),
  18.         ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u8b10"),
  19.         ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u8b10\ufffd"),
  20.         ("abc\x80\x80\xc1\xc4", "ignore",  u"abc\u8b10"),
  21.     )
  22.  
  23. def test_main():
  24.     test_support.run_unittest(__name__)
  25.  
  26. if __name__ == "__main__":
  27.     test_main()
  28.