[Python-checkins] r81276 - python/branches/py3k/Lib/test/test_sys.py

victor.stinner python-checkins at python.org
Mon May 17 21:57:40 CEST 2010


Author: victor.stinner
Date: Mon May 17 21:57:40 2010
New Revision: 81276

Log:
Fix test_main_invalid_unicode() of test_sys for ASCII locale encoding

It should fix sparc 3.x and 3.1 failures.


Modified:
   python/branches/py3k/Lib/test/test_sys.py

Modified: python/branches/py3k/Lib/test/test_sys.py
==============================================================================
--- python/branches/py3k/Lib/test/test_sys.py	(original)
+++ python/branches/py3k/Lib/test/test_sys.py	Mon May 17 21:57:40 2010
@@ -152,7 +152,7 @@
             stdout, stderr = process.communicate()
             self.assertEqual(process.returncode, 1)
             self.assertTrue(stderr.startswith(expected),
-                            "%r doesn't start with %r" % (stderr, expected))
+                "%s doesn't start with %s" % (ascii(stderr), ascii(expected)))
 
         # test that stderr buffer if flushed before the exit message is written
         # into stderr
@@ -485,9 +485,8 @@
         p = subprocess.Popen([sys.executable, "-c", code], stderr=subprocess.PIPE)
         stdout, stderr = p.communicate()
         self.assertEqual(p.returncode, 1)
-        self.assert_(stderr.startswith(b"UnicodeEncodeError: "
-            b"'utf-8' codec can't encode character '\\udcff' in "
-            b"position 7: surrogates not allowed"), stderr)
+        self.assert_(b"UnicodeEncodeError:" in stderr,
+            "%r not in %s" % (b"UniodeEncodeError:", ascii(stderr)))
 
     def test_sys_flags(self):
         self.assertTrue(sys.flags)


More information about the Python-checkins mailing list