summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Lechner <david@pybricks.com>2020-04-08 12:17:28 -0500
committerDamien George <damien@micropython.org>2021-07-01 13:23:54 +1000
commit58e4d723383dfd9856520728b0920ff20fa76407 (patch)
tree634cc3779be6996f41a9314f73733f6c588147a4 /tests
parent41adf178309759d5965c15972f04987a2635314c (diff)
py/objexcept: Pretty print OSError also when it has 2 arguments.
This extends pretty-printing of OSError's to handle two arguments when the exception name is known. Signed-off-by: David Lechner <david@pybricks.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/errno1.py4
-rw-r--r--tests/basics/errno1.py.exp2
2 files changed, 6 insertions, 0 deletions
diff --git a/tests/basics/errno1.py b/tests/basics/errno1.py
index d7a5ccd54..d9a895a97 100644
--- a/tests/basics/errno1.py
+++ b/tests/basics/errno1.py
@@ -12,6 +12,10 @@ print(type(uerrno.EIO))
# check that errors are rendered in a nice way
msg = str(OSError(uerrno.EIO))
print(msg[:7], msg[-5:])
+msg = str(OSError(uerrno.EIO, "details"))
+print(msg[:7], msg[-14:])
+msg = str(OSError(uerrno.EIO, "details", "more details"))
+print(msg[:1], msg[-28:])
# check that unknown errno is still rendered
print(str(OSError(9999)))
diff --git a/tests/basics/errno1.py.exp b/tests/basics/errno1.py.exp
index 7dd22757d..58605b476 100644
--- a/tests/basics/errno1.py.exp
+++ b/tests/basics/errno1.py.exp
@@ -1,4 +1,6 @@
<class 'int'>
[Errno ] EIO
+[Errno ] EIO: details
+( , 'details', 'more details')
9999
uerrno