[Python-checkins] cpython (3.3): Silence BytesWarning (backport 267a4d4d9d65).

serhiy.storchaka python-checkins at python.org
Thu Feb 6 23:29:06 CET 2014


http://hg.python.org/cpython/rev/98d9d152e94b
changeset:   89003:98d9d152e94b
branch:      3.3
parent:      89000:791674a74e47
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Fri Feb 07 00:26:57 2014 +0200
summary:
  Silence BytesWarning (backport 267a4d4d9d65).

files:
  Lib/test/test_exceptions.py |  11 ++++++-----
  1 files changed, 6 insertions(+), 5 deletions(-)


diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -8,8 +8,8 @@
 import errno
 
 from test.support import (TESTFN, captured_output, check_impl_detail,
-                          cpython_only, gc_collect, run_unittest, no_tracing,
-                          unlink)
+                          check_warnings, cpython_only, gc_collect,
+                          no_tracing, run_unittest, unlink)
 
 class NaiveException(Exception):
     def __init__(self, x):
@@ -960,9 +960,10 @@
 
     def test_non_str_argument(self):
         # Issue #15778
-        arg = b'abc'
-        exc = ImportError(arg)
-        self.assertEqual(str(arg), str(exc))
+        with check_warnings(('', BytesWarning), quiet=True):
+            arg = b'abc'
+            exc = ImportError(arg)
+            self.assertEqual(str(arg), str(exc))
 
 
 def test_main():

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list