[Python-checkins] cpython: Issue #19424: Fix test_warnings for locale encoding unable to encode
victor.stinner
python-checkins at python.org
Tue Oct 29 23:58:15 CET 2013
http://hg.python.org/cpython/rev/05e8dde3229c
changeset: 86770:05e8dde3229c
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Oct 29 23:58:05 2013 +0100
summary:
Issue #19424: Fix test_warnings for locale encoding unable to encode
"\xe9\u20ac" characters
files:
Lib/test/test_warnings.py | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
--- a/Lib/test/test_warnings.py
+++ b/Lib/test/test_warnings.py
@@ -336,12 +336,13 @@
module=self.module) as w:
self.module.resetwarnings()
self.module.filterwarnings("always", category=UserWarning)
-
- self.module.warn_explicit("text", UserWarning, "nonascii\xe9\u20ac", 1)
- self.assertEqual(w[-1].filename, "nonascii\xe9\u20ac")
-
- self.module.warn_explicit("text", UserWarning, "surrogate\udc80", 1)
- self.assertEqual(w[-1].filename, "surrogate\udc80")
+ for filename in ("nonascii\xe9\u20ac", "surrogate\udc80"):
+ try:
+ os.fsencode(filename)
+ except UnicodeEncodeError:
+ continue
+ self.module.warn_explicit("text", UserWarning, filename, 1)
+ self.assertEqual(w[-1].filename, filename)
def test_warn_explicit_type_errors(self):
# warn_explicit() should error out gracefully if it is given objects
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list