Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe4ef39

Browse files
Silence BytesWarning (backport 267a4d4d9d65).
1 parent bc27a05 commit fe4ef39

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

Lib/test/test_exceptions.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import errno
99

1010
from test.support import (TESTFN, captured_output, check_impl_detail,
11-
cpython_only, gc_collect, run_unittest, no_tracing,
12-
unlink)
11+
check_warnings, cpython_only, gc_collect,
12+
no_tracing, run_unittest, unlink)
1313

1414
class NaiveException(Exception):
1515
def __init__(self, x):
@@ -960,9 +960,10 @@ def test_attributes(self):
960960

961961
def test_non_str_argument(self):
962962
# Issue #15778
963-
arg = b'abc'
964-
exc = ImportError(arg)
965-
self.assertEqual(str(arg), str(exc))
963+
with check_warnings(('', BytesWarning), quiet=True):
964+
arg = b'abc'
965+
exc = ImportError(arg)
966+
self.assertEqual(str(arg), str(exc))
966967

967968

968969
def test_main():

0 commit comments

Comments
 (0)