diff options
author | Guido van Rossum <guido@python.org> | 2007-07-09 09:18:12 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-07-09 09:18:12 (GMT) |
commit | a222e4cc71d7f4f6479e3be4f015673dafb078e3 (patch) | |
tree | 03175ae08764aca2dd7411970e8eba3d352591f9 /Lib | |
parent | 89687b9ba8dde610247805629187486a270af725 (diff) | |
download | cpython-a222e4cc71d7f4f6479e3be4f015673dafb078e3.zip cpython-a222e4cc71d7f4f6479e3be4f015673dafb078e3.tar.gz cpython-a222e4cc71d7f4f6479e3be4f015673dafb078e3.tar.bz2 |
Fix the last remaining problem with test_multibytecodec.py;
the problem was writing a file in text mode instead of in binary mode.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_multibytecodec.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py index 472f620..32c48fb 100644 --- a/Lib/test/test_multibytecodec.py +++ b/Lib/test/test_multibytecodec.py @@ -51,7 +51,7 @@ class Test_MultibyteCodec(unittest.TestCase): print('# coding:', enc, file=io.open(TESTFN, 'w')) execfile(TESTFN) finally: - os.unlink(TESTFN) + test_support.unlink(TESTFN) class Test_IncrementalEncoder(unittest.TestCase): @@ -139,13 +139,18 @@ class Test_IncrementalDecoder(unittest.TestCase): class Test_StreamReader(unittest.TestCase): def test_bug1728403(self): try: - open(TESTFN, 'w').write('\xa1') + f = open(TESTFN, 'wb') + try: + f.write(b'\xa1') + finally: + f.close() f = codecs.open(TESTFN, encoding='cp949') - self.assertRaises(UnicodeDecodeError, f.read, 2) + try: + self.assertRaises(UnicodeDecodeError, f.read, 2) + finally: + f.close() finally: - try: f.close() - except: pass - os.unlink(TESTFN) + test_support.unlink(TESTFN) class Test_StreamWriter(unittest.TestCase): if len('\U00012345') == 2: # UCS2 |