Author: guido.van.rossum
Date: Mon Jul  9 11:18:12 2007
New Revision: 56208

Modified:
   python/branches/py3k-struni/Lib/test/test_multibytecodec.py
Log:
Fix the last remaining problem with test_multibytecodec.py;
the problem was writing a file in text mode instead of in binary mode.


Modified: python/branches/py3k-struni/Lib/test/test_multibytecodec.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_multibytecodec.py (original)
+++ python/branches/py3k-struni/Lib/test/test_multibytecodec.py Mon Jul  9 
11:18:12 2007
@@ -51,7 +51,7 @@
                 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_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
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to