Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r46159:1a4938c4eb0a Date: 2011-08-01 17:46 +0200 http://bitbucket.org/pypy/pypy/changeset/1a4938c4eb0a/
Log: Wrong, we can't say "final" in StreamWriter.write(). diff --git a/pypy/module/_multibytecodec/app_multibytecodec.py b/pypy/module/_multibytecodec/app_multibytecodec.py --- a/pypy/module/_multibytecodec/app_multibytecodec.py +++ b/pypy/module/_multibytecodec/app_multibytecodec.py @@ -40,7 +40,7 @@ return self def write(self, data): - self.stream.write(MultibyteIncrementalEncoder.encode(self, data, True)) + self.stream.write(MultibyteIncrementalEncoder.encode(self, data)) def writelines(self, lines): for data in lines: diff --git a/pypy/module/_multibytecodec/test/test_app_stream.py b/pypy/module/_multibytecodec/test/test_app_stream.py --- a/pypy/module/_multibytecodec/test/test_app_stream.py +++ b/pypy/module/_multibytecodec/test/test_app_stream.py @@ -22,6 +22,15 @@ return HzStreamWriter """) + cls.w_ShiftJisx0213StreamWriter = cls.space.appexec([], """(): + import _codecs_jp + from _multibytecodec import MultibyteStreamWriter + + class ShiftJisx0213StreamWriter(MultibyteStreamWriter): + codec = _codecs_jp.getcodec('shift_jisx0213') + + return ShiftJisx0213StreamWriter + """) def test_reader(self): class FakeFile: @@ -69,3 +78,16 @@ w.write(input) assert w.stream.output == ['!', '~{ab~}', '~{cd~}', 'x', 'y', 'z', '~{ef~}', '~{gh~}'] + + def test_no_flush(self): + class FakeFile: + def __init__(self): + self.output = [] + def write(self, data): + self.output.append(data) + # + w = self.ShiftJisx0213StreamWriter(FakeFile()) + w.write(u'\u30ce') + w.write(u'\u304b') + w.write(u'\u309a') + assert w.stream.output == ['\x83m', '', '\x82\xf5'] _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit