forked from Rust-related/RustPython
- Move assert_raises to testutils - Add optional message argument, with reasonable default - Reverse order of expr and exception type for readability - Lambda argument no longer takes parameter - Convert applicable snippets to use assert_raises
12 lines
369 B
Python
12 lines
369 B
Python
from testutils import assert_raises
|
|
|
|
print(2 + 3)
|
|
|
|
assert_raises(TypeError, lambda: print('test', end=4), 'wrong type passed to end')
|
|
assert_raises(TypeError, lambda: print('test', sep=['a']), 'wrong type passed to sep')
|
|
|
|
try:
|
|
print('test', end=None, sep=None, flush=None)
|
|
except:
|
|
assert False, 'Expected None passed to end, sep, and flush to not raise errors'
|