We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 582b190 commit b92a8adCopy full SHA for b92a8ad
2 files changed
tests/io/builtin_print_file.py
@@ -0,0 +1,17 @@
1
+# test builtin print function, using file= argument
2
+
3
+import sys
4
5
+try:
6
+ sys.stdout
7
+except AttributeError:
8
+ print('SKIP')
9
+ raise SystemExit
10
11
+print(file=sys.stdout)
12
+print('test', file=sys.stdout)
13
14
15
+ print(file=1)
16
+except (AttributeError, OSError): # CPython and uPy differ in error message
17
+ print('Error')
tests/misc/print_exception.py
@@ -56,3 +56,12 @@ def f():
56
f()
57
except Exception as e:
58
print_exc(e)
59
60
+# Test non-stream object passed as output object, only valid for uPy
61
+if hasattr(sys, 'print_exception'):
62
+ try:
63
+ sys.print_exception(Exception, 1)
64
+ had_exception = False
65
+ except OSError:
66
+ had_exception = True
67
+ assert had_exception
0 commit comments