[Python-checkins] python/dist/src/Lib/test test_codecencodings_hk.py, NONE, 1.1 test_codecmaps_hk.py, NONE, 1.1 cjkencodings_test.py, 1.1, 1.2 test_codecencodings_cn.py, 1.2, 1.3 test_codecencodings_jp.py, 1.2, 1.3 test_codecencodings_kr.py, 1.2, 1.3 test_codecencodings_tw.py, 1.2, 1.3 test_codecmaps_cn.py, 1.2, 1.3 test_codecmaps_jp.py, 1.2, 1.3 test_codecmaps_kr.py, 1.2, 1.3 test_codecmaps_tw.py, 1.2, 1.3 test_multibytecodec.py, 1.3, 1.4 test_multibytecodec_support.py, 1.4, 1.5

perky at users.sourceforge.net perky at users.sourceforge.net
Sun Jul 18 05:07:00 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9316/Lib/test

Modified Files:
	cjkencodings_test.py test_codecencodings_cn.py 
	test_codecencodings_jp.py test_codecencodings_kr.py 
	test_codecencodings_tw.py test_codecmaps_cn.py 
	test_codecmaps_jp.py test_codecmaps_kr.py test_codecmaps_tw.py 
	test_multibytecodec.py test_multibytecodec_support.py 
Added Files:
	test_codecencodings_hk.py test_codecmaps_hk.py 
Log Message:
Bring CJKCodecs 1.1 into trunk.  This completely reorganizes source
and installed layouts to make maintenance simple and easy.  And it
also adds four new codecs; big5hkscs, euc-jis-2004, shift-jis-2004
and iso2022-jp-2004.


--- NEW FILE: test_codecencodings_hk.py ---
#!/usr/bin/env python
#
# test_codecencodings_hk.py
#   Codec encoding tests for HongKong encodings.
#
# $CJKCodecs: test_codecencodings_hk.py,v 1.1 2004/07/10 17:35:20 perky Exp $

from test import test_support
from test import test_multibytecodec_support
import unittest

class Test_Big5HKSCS(test_multibytecodec_support.TestBase, unittest.TestCase):
    encoding = 'big5hkscs'
    tstring = test_multibytecodec_support.load_teststring('big5hkscs')
    codectests = (
        # invalid bytes
        ("abc\x80\x80\xc1\xc4", "strict",  None),
        ("abc\xc8", "strict",  None),
        ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u8b10"),
        ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u8b10\ufffd"),
        ("abc\x80\x80\xc1\xc4", "ignore",  u"abc\u8b10"),
    )

def test_main():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(Test_Big5HKSCS))
    test_support.run_suite(suite)

if __name__ == "__main__":
    test_main()

--- NEW FILE: test_codecmaps_hk.py ---
#!/usr/bin/env python
#
# test_codecmaps_hk.py
#   Codec mapping tests for HongKong encodings
#
# $CJKCodecs: test_codecmaps_hk.py,v 1.1 2004/07/10 17:35:20 perky Exp $

from test import test_support
from test import test_multibytecodec_support
import unittest

class TestBig5HKSCSMap(test_multibytecodec_support.TestBase_Mapping,
                       unittest.TestCase):
    encoding = 'big5hkscs'
    mapfilename = 'BIG5HKSCS.TXT'
    mapfileurl = 'http://people.freebsd.org/~perky/i18n/BIG5HKSCS.TXT'

def test_main():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestBig5HKSCSMap))
    test_support.run_suite(suite)

test_multibytecodec_support.register_skip_expected(TestBig5HKSCSMap)
if __name__ == "__main__":
    test_main()

Index: cjkencodings_test.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/cjkencodings_test.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** cjkencodings_test.py	17 Jan 2004 14:29:28 -0000	1.1
--- cjkencodings_test.py	18 Jul 2004 03:06:26 -0000	1.2
***************
*** 64,67 ****
--- 64,70 ----
  "\xab\x96\xe7\x9a\x84\xe5\x95\x8f\xe9\xa1\x8c\xe5\xb0\xb1\xe6\x98"
  "\xaf\x3a\x0a\x0a"),
+ 'big5hkscs': (
+ "\x88\x45\x88\x5c\x8a\x73\x8b\xda\x8d\xd8\x0a",
+ "\xf0\xa0\x84\x8c\xc4\x9a\xe9\xb5\xae\xe7\xbd\x93\xe6\xb4\x86\x0a"),
  'cp949': (
  "\x8c\x63\xb9\xe6\xb0\xa2\xc7\xcf\x20\xbc\x84\xbd\xc3\xc4\xdd\xb6"

Index: test_codecencodings_cn.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecencodings_cn.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_codecencodings_cn.py	18 Jan 2004 20:29:54 -0000	1.2
--- test_codecencodings_cn.py	18 Jul 2004 03:06:26 -0000	1.3
***************
*** 4,8 ****
  #   Codec encoding tests for PRC encodings.
  #
! # $CJKCodecs: test_codecencodings_cn.py,v 1.1 2003/12/19 03:00:05 perky Exp $
  
  from test import test_support
--- 4,8 ----
  #   Codec encoding tests for PRC encodings.
  #
! # $CJKCodecs: test_codecencodings_cn.py,v 1.2 2004/06/19 06:09:55 perky Exp $
  
  from test import test_support
***************
*** 28,33 ****
      codectests = (
          # invalid bytes
!         ("abc\x80\x80\xc1\xc4", "strict",  None),
!         ("abc\xc8", "strict",  None),
          ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u804a"),
          ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u804a\ufffd"),
--- 28,33 ----
      codectests = (
          # invalid bytes
!         ("abc\x80\x80\xc1\xc4", "strict",  None),  
!         ("abc\xc8", "strict",  None),  
          ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u804a"),
          ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u804a\ufffd"),

Index: test_codecencodings_jp.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecencodings_jp.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_codecencodings_jp.py	18 Jan 2004 20:29:54 -0000	1.2
--- test_codecencodings_jp.py	18 Jul 2004 03:06:26 -0000	1.3
***************
*** 4,8 ****
  #   Codec encoding tests for Japanese encodings.
  #
! # $CJKCodecs: test_codecencodings_jp.py,v 1.2 2004/01/06 09:25:37 perky Exp $
  
  from test import test_support
--- 4,8 ----
  #   Codec encoding tests for Japanese encodings.
  #
! # $CJKCodecs: test_codecencodings_jp.py,v 1.3 2004/06/19 06:09:55 perky Exp $
  
  from test import test_support
***************
*** 65,78 ****
      )
  
- class Test_EUC_JP_STRICT(test_multibytecodec_support.TestBase,
-                          unittest.TestCase):
-     encoding = 'euc_jp_strict'
-     tstring = test_multibytecodec_support.load_teststring('euc_jp')
-     codectests = eucjp_commontests + (
-         ("\xa1\xc0\\", "strict", u"\\\\"),
-         (u"\xa5", "strict", None),
-         (u"\u203e", "strict", None),
-     )
- 
  shiftjis_commonenctests = (
      ("abc\x80\x80\x82\x84", "strict",  None),
--- 65,68 ----
***************
*** 91,102 ****
      )
  
- class Test_SJIS_STRICT(test_multibytecodec_support.TestBase, unittest.TestCase):
-     encoding = 'shift_jis_strict'
-     tstring = test_multibytecodec_support.load_teststring('shift_jis')
-     codectests = shiftjis_commonenctests + (
-         ("\\\x7e", "replace", u"\xa5\u203e"),
-         ("\x81\x5f\x81\x61\x81\x7c", "replace", u"\x5c\u2016\u2212"),
-     )
- 
  class Test_SJISX0213(test_multibytecodec_support.TestBase, unittest.TestCase):
      encoding = 'shift_jisx0213'
--- 81,84 ----
***************
*** 124,130 ****
      suite.addTest(unittest.makeSuite(Test_EUC_JP_COMPAT))
      suite.addTest(unittest.makeSuite(Test_SJIS_COMPAT))
-     if test_multibytecodec_support.__cjkcodecs__:
-         suite.addTest(unittest.makeSuite(Test_EUC_JP_STRICT))
-         suite.addTest(unittest.makeSuite(Test_SJIS_STRICT))
      suite.addTest(unittest.makeSuite(Test_SJISX0213))
      test_support.run_suite(suite)
--- 106,109 ----

Index: test_codecencodings_kr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecencodings_kr.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_codecencodings_kr.py	18 Jan 2004 20:29:54 -0000	1.2
--- test_codecencodings_kr.py	18 Jul 2004 03:06:26 -0000	1.3
***************
*** 4,8 ****
  #   Codec encoding tests for ROK encodings.
  #
! # $CJKCodecs: test_codecencodings_kr.py,v 1.1 2003/12/19 03:00:06 perky Exp $
  
  from test import test_support
--- 4,8 ----
  #   Codec encoding tests for ROK encodings.
  #
! # $CJKCodecs: test_codecencodings_kr.py,v 1.2 2004/06/19 06:09:55 perky Exp $
  
  from test import test_support

Index: test_codecencodings_tw.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecencodings_tw.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_codecencodings_tw.py	18 Jan 2004 20:29:54 -0000	1.2
--- test_codecencodings_tw.py	18 Jul 2004 03:06:26 -0000	1.3
***************
*** 4,8 ****
  #   Codec encoding tests for ROC encodings.
  #
! # $CJKCodecs: test_codecencodings_tw.py,v 1.1 2003/12/19 03:00:06 perky Exp $
  
  from test import test_support
--- 4,8 ----
  #   Codec encoding tests for ROC encodings.
  #
! # $CJKCodecs: test_codecencodings_tw.py,v 1.2 2004/06/19 06:09:55 perky Exp $
  
  from test import test_support

Index: test_codecmaps_cn.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecmaps_cn.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_codecmaps_cn.py	18 Jan 2004 20:29:54 -0000	1.2
--- test_codecmaps_cn.py	18 Jul 2004 03:06:26 -0000	1.3
***************
*** 4,8 ****
  #   Codec mapping tests for PRC encodings
  #
! # $CJKCodecs: test_codecmaps_cn.py,v 1.2 2004/01/17 12:47:19 perky Exp $
  
  from test import test_support
--- 4,8 ----
  #   Codec mapping tests for PRC encodings
  #
! # $CJKCodecs: test_codecmaps_cn.py,v 1.3 2004/06/19 06:09:55 perky Exp $
  
  from test import test_support

Index: test_codecmaps_jp.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecmaps_jp.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_codecmaps_jp.py	18 Jan 2004 20:29:55 -0000	1.2
--- test_codecmaps_jp.py	18 Jul 2004 03:06:26 -0000	1.3
***************
*** 4,8 ****
  #   Codec mapping tests for Japanese encodings
  #
! # $CJKCodecs: test_codecmaps_jp.py,v 1.2 2004/01/17 12:47:19 perky Exp $
  
  from test import test_support
--- 4,8 ----
  #   Codec mapping tests for Japanese encodings
  #
! # $CJKCodecs: test_codecmaps_jp.py,v 1.3 2004/06/19 06:09:55 perky Exp $
  
  from test import test_support
***************
*** 49,61 ****
      ]
  
- 
- class TestSJISSTRICTMap(test_multibytecodec_support.TestBase_Mapping,
-                         unittest.TestCase):
-     encoding = 'shift_jis_strict'
-     mapfilename = 'SHIFTJIS.TXT'
-     mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/OBSOLETE' \
-                  '/EASTASIA/JIS/SHIFTJIS.TXT'
- 
- 
  class TestEUCJISX0213Map(test_multibytecodec_support.TestBase_Mapping,
                           unittest.TestCase):
--- 49,52 ----
***************
*** 77,82 ****
      suite.addTest(unittest.makeSuite(TestEUCJPCOMPATMap))
      suite.addTest(unittest.makeSuite(TestSJISCOMPATMap))
-     if test_multibytecodec_support.__cjkcodecs__:
-         suite.addTest(unittest.makeSuite(TestSJISSTRICTMap))
      suite.addTest(unittest.makeSuite(TestEUCJISX0213Map))
      suite.addTest(unittest.makeSuite(TestSJISX0213Map))
--- 68,71 ----
***************
*** 86,89 ****
--- 75,79 ----
      TestEUCJPCOMPATMap, TestSJISCOMPATMap, TestEUCJISX0213Map,
      TestSJISX0213Map)
+ 
  if __name__ == "__main__":
      test_main()

Index: test_codecmaps_kr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecmaps_kr.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_codecmaps_kr.py	18 Jan 2004 20:29:55 -0000	1.2
--- test_codecmaps_kr.py	18 Jul 2004 03:06:26 -0000	1.3
***************
*** 4,8 ****
  #   Codec mapping tests for ROK encodings
  #
! # $CJKCodecs: test_codecmaps_kr.py,v 1.2 2004/01/17 12:47:19 perky Exp $
  
  from test import test_support
--- 4,8 ----
  #   Codec mapping tests for ROK encodings
  #
! # $CJKCodecs: test_codecmaps_kr.py,v 1.3 2004/06/19 06:09:55 perky Exp $
  
  from test import test_support

Index: test_codecmaps_tw.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecmaps_tw.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_codecmaps_tw.py	18 Jan 2004 20:29:55 -0000	1.2
--- test_codecmaps_tw.py	18 Jul 2004 03:06:26 -0000	1.3
***************
*** 4,8 ****
  #   Codec mapping tests for ROC encodings
  #
! # $CJKCodecs: test_codecmaps_tw.py,v 1.2 2004/01/17 12:47:19 perky Exp $
  
  from test import test_support
--- 4,8 ----
  #   Codec mapping tests for ROC encodings
  #
! # $CJKCodecs: test_codecmaps_tw.py,v 1.3 2004/06/19 06:09:55 perky Exp $
  
  from test import test_support

Index: test_multibytecodec.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_multibytecodec.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_multibytecodec.py	20 Jan 2004 09:11:48 -0000	1.3
--- test_multibytecodec.py	18 Jul 2004 03:06:26 -0000	1.4
***************
*** 4,8 ****
  #   Unit test for multibytecodec itself
  #
! # $CJKCodecs: test_multibytecodec.py,v 1.5 2004/01/06 02:26:28 perky Exp $
  
  from test import test_support
--- 4,8 ----
  #   Unit test for multibytecodec itself
  #
! # $CJKCodecs: test_multibytecodec.py,v 1.8 2004/06/19 06:09:55 perky Exp $
  
  from test import test_support
***************
*** 70,73 ****
--- 70,79 ----
          self.assertEqual('abcd'.encode('gb18030'), 'abcd')
  
+     def test_streamwriter_strwrite(self):
+         s = StringIO.StringIO()
+         wr = codecs.getwriter('gb18030')(s)
+         wr.write('abcd')
+         self.assertEqual(s.getvalue(), 'abcd')
+ 
  def test_main():
      suite = unittest.TestSuite()

Index: test_multibytecodec_support.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_multibytecodec_support.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** test_multibytecodec_support.py	8 Jul 2004 04:22:19 -0000	1.4
--- test_multibytecodec_support.py	18 Jul 2004 03:06:26 -0000	1.5
***************
*** 4,8 ****
  #   Common Unittest Routines for CJK codecs
  #
! # $CJKCodecs: test_multibytecodec_support.py,v 1.5 2004/01/17 12:47:19 perky Exp $
  
  import sys, codecs, os.path
--- 4,8 ----
  #   Common Unittest Routines for CJK codecs
  #
! # $CJKCodecs: test_multibytecodec_support.py,v 1.6 2004/06/19 06:09:55 perky Exp $
  
  import sys, codecs, os.path
***************
*** 165,175 ****
          unittest.TestCase.__init__(self, *args, **kw)
          if not os.path.exists(self.mapfilename):
!             parent = os.path.join(os.pardir, self.mapfilename)
!             if not os.path.exists(parent):
!                 format = '%s not found, download from %s'
!                 raise test_support.TestSkipped(format %
!                         (self.mapfilename, self.mapfileurl))
!             else:
!                 self.mapfilename = parent
  
      def test_mapping_file(self):
--- 165,170 ----
          unittest.TestCase.__init__(self, *args, **kw)
          if not os.path.exists(self.mapfilename):
!             raise test_support.TestSkipped('%s not found, download from %s' %
!                     (self.mapfilename, self.mapfileurl))
  
      def test_mapping_file(self):



More information about the Python-checkins mailing list