summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2012-08-24 17:05:09 (GMT)
committerBrett Cannon <brett@python.org>2012-08-24 17:05:09 (GMT)
commit07c6e7168919c275e47fa35c741413270d3d80fd (patch)
tree5dd658c5cf3b17902ddaf1c9dcc0c7d34dfeb6a6 /Lib/test/test_exceptions.py
parent491b1dc79efd4d3fc39b0ded2cd3fd746154b882 (diff)
downloadcpython-07c6e7168919c275e47fa35c741413270d3d80fd.zip
cpython-07c6e7168919c275e47fa35c741413270d3d80fd.tar.gz
cpython-07c6e7168919c275e47fa35c741413270d3d80fd.tar.bz2
Issue #15778: Coerce ImportError.args to a string when it isn't
already one. Patch by Dave Malcolm.
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 0b1fd1b..55e9db3 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -937,6 +937,11 @@ class ImportErrorTests(unittest.TestCase):
self.assertEqual(exc.name, 'somename')
self.assertEqual(exc.path, 'somepath')
+ def test_non_str_argument(self):
+ # Issue #15778
+ arg = b'abc'
+ exc = ImportError(arg)
+ self.assertEqual(str(arg), str(exc))
def test_main():