test_displayhook.py
28 lines
| 850 B
| text/x-python
|
PythonLexer
nottaanibot
|
r21420 | from IPython.testing.tools import AssertPrints, AssertNotPrints | ||
nottaanibot
|
r21421 | ip = get_ipython() | ||
nottaanibot
|
r21420 | def test_output_displayed(): | ||
"""Checking to make sure that output is displayed""" | ||||
with AssertPrints('2'): | ||||
Matthias Bussonnier
|
r21425 | ip.run_cell('1+1', store_history=True) | ||
nottaanibot
|
r21420 | |||
with AssertPrints('2'): | ||||
Matthias Bussonnier
|
r21425 | ip.run_cell('1+1 # comment with a semicolon;', store_history=True) | ||
Sebastian Bank
|
r22076 | |||
with AssertPrints('2'): | ||||
ip.run_cell('1+1\n#commented_out_function();', store_history=True) | ||||
nottaanibot
|
r21420 | |||
def test_output_quiet(): | ||||
"""Checking to make sure that output is quiet""" | ||||
with AssertNotPrints('2'): | ||||
Matthias Bussonnier
|
r21425 | ip.run_cell('1+1;', store_history=True) | ||
nottaanibot
|
r21420 | |||
with AssertNotPrints('2'): | ||||
Matthias Bussonnier
|
r21425 | ip.run_cell('1+1; # comment with a semicolon', store_history=True) | ||
Sebastian Bank
|
r22076 | |||
with AssertNotPrints('2'): | ||||
ip.run_cell('1+1;\n#commented_out_function()', store_history=True) | ||||