[KoCo-CVS] [Commit] cjkcodecs/tests test_multibytecodec_support.py
Brought to you by:
perky
From: Hye-Shik C. <pe...@us...> - 2003-07-19 10:46:16
|
perky 03/07/19 03:46:09 Modified: tests test_multibytecodec_support.py Log: Remove UTF-16 codec and explain why we still keep utf-7 and utf-8 codecs. Revision Changes Path 1.9 +12 -8 cjkcodecs/tests/test_multibytecodec_support.py Index: test_multibytecodec_support.py =================================================================== RCS file: /cvsroot/koco/cjkcodecs/tests/test_multibytecodec_support.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- test_multibytecodec_support.py 12 Jul 2003 15:06:09 -0000 1.8 +++ test_multibytecodec_support.py 19 Jul 2003 10:46:09 -0000 1.9 @@ -27,7 +27,7 @@ # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # -# $Id: test_multibytecodec_support.py,v 1.8 2003/07/12 15:06:09 perky Exp $ +# $Id: test_multibytecodec_support.py,v 1.9 2003/07/19 10:46:09 perky Exp $ # import sys, codecs, os.path @@ -116,7 +116,7 @@ "test.xmlcharnamereplace")[0], sout) def test_streamreader(self): - UTF8Writer = codecs.lookup('utf-8')[3] + UTF8Writer = codecs.getwriter('utf-8') for name in ["read", "readline", "readlines"]: for sizehint in [None, -1] + range(1, 33) + \ [64, 128, 256, 512, 1024]: @@ -135,18 +135,22 @@ self.assertEqual(ostream.getvalue(), self.tstring[1]) def test_streamwriter(self): - # We can't test with the real utf-8 StreamReader here. - # The standard SR.readline{,s} are mostly broken for multibyte seqs. - #UTF8Reader = codecs.lookup('utf-8')[2] - UTF8Reader = codecs.lookup('cjkcodecs.utf-8')[2] + # don't use standard utf-8 streamreader here. + # it's broken for sr.readline(smallnumber) + UTF8Reader = codecs.getreader('cjkcodecs.utf-8') for name in ["read", "readline", "readlines"]: - for sizehint in [None, -1] + range(1, 33) + \ + for sizehint in [None] + range(1, 33) + \ [64, 128, 256, 512, 1024]: istream = UTF8Reader(StringIO(self.tstring[1])) ostream = self.writer(StringIO()) func = getattr(istream, name) while 1: - data = func(sizehint) + print name, sizehint + if sizehint is not None: + data = func(sizehint) + else: + data = func() + if not data: break if name == "readlines": |