[KoCo-CVS] [Commit] KoreanCodecs/test CodecTestBase.py test_iso_2022_kr.py
Brought to you by:
perky
From: Hye-Shik C. <pe...@us...> - 2003-01-10 06:08:22
|
perky 03/01/09 22:08:22 Modified: test CodecTestBase.py test_iso_2022_kr.py Log: Don't test roundtrip for iso-2022-kr Revision Changes Path 1.9 +5 -3 KoreanCodecs/test/CodecTestBase.py Index: CodecTestBase.py =================================================================== RCS file: /cvsroot/koco/KoreanCodecs/test/CodecTestBase.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- CodecTestBase.py 9 Jan 2003 21:41:37 -0000 1.8 +++ CodecTestBase.py 10 Jan 2003 06:08:21 -0000 1.9 @@ -16,7 +16,7 @@ # along with KoreanCodecs; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# $Id: CodecTestBase.py,v 1.8 2003/01/09 21:41:37 perky Exp $ +# $Id: CodecTestBase.py,v 1.9 2003/01/10 06:08:21 perky Exp $ # import StringIO @@ -40,8 +40,9 @@ encoding = '' # codec name textfile_chunk = None # (native, utf-8) file name tuple textfile_stream = None # (native, utf-8) - + errortests = None # must set. error test tuple + roundtriptest = 1 # set if roundtrip is possible with unicode def setUp(self): if not self.textfile_chunk: @@ -54,7 +55,8 @@ for native, utf8 in zip(*[open(f).readlines() for f in self.textfile_chunk]): u = unicode(native, self.encoding) self.assertEqual(u, unicode(utf8, 'utf-8')) - self.assertEqual(native, u.encode(self.encoding)) + if self.roundtriptest: + self.assertEqual(native, u.encode(self.encoding)) def test_ErrorHandling(self): encode, decode, Reader, Writer = codecs.lookup(self.encoding) 1.6 +5 -4 KoreanCodecs/test/test_iso_2022_kr.py Index: test_iso_2022_kr.py =================================================================== RCS file: /cvsroot/koco/KoreanCodecs/test/test_iso_2022_kr.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- test_iso_2022_kr.py 9 Jan 2003 21:41:37 -0000 1.5 +++ test_iso_2022_kr.py 10 Jan 2003 06:08:22 -0000 1.6 @@ -16,7 +16,7 @@ # along with KoreanCodecs; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# $Id: test_iso_2022_kr.py,v 1.5 2003/01/09 21:41:37 perky Exp $ +# $Id: test_iso_2022_kr.py,v 1.6 2003/01/10 06:08:22 perky Exp $ # import CodecTestBase @@ -25,12 +25,13 @@ encoding = 'iso-2022-kr' textfile_chunk = ('texts/%s.roundrobin' % encoding, 'texts/%s.utf-8' % encoding) textfile_stream = ('texts/%s.stream' % encoding, 'texts/%s.utf-8' % encoding) + roundtriptest = 0 errortests = ( # invalid bytes - ("abc\x1b$)C\x0e\x00\x00AD\x0f\x1b$(B", "strict", None), - ("abc\x1b$)C\x0e\x00\x00AD\x0f\x1b$(B", "replace", u"abc\ufffd\uc894"), - ("abc\x1b$)C\x0e\x00\x00AD\x0f\x1b$(B", "ignore", u"abc\uc894"), + ("abc\x1b$)C\x0eA\x12AD\x0f\x1b$(B", "strict", None), + ("abc\x1b$)C\x0eA\x12AD\x0f\x1b$(B", "replace", u"abc\ufffd\uc894"), + ("abc\x1b$)C\x0eA\x12AD\x0f\x1b$(B", "ignore", u"abc\uc894"), ) if __name__ == '__main__': |