##// END OF EJS Templates
Merge pull request #10225 from anntzer/vi-mode-v-edit...
Merge pull request #10225 from anntzer/vi-mode-v-edit Add 'v' binding in vi-navigation-mode to %edit.

File last commit:

r22838:138b3a4a
r23283:1347d9a1 merge
Show More
test_displayhook.py
55 lines | 1.6 KiB | text/x-python | PythonLexer
/ IPython / core / tests / test_displayhook.py
nottaanibot
Added tests for displayhook...
r21420 from IPython.testing.tools import AssertPrints, AssertNotPrints
nottaanibot
make the tests fail correctly
r21421 ip = get_ipython()
nottaanibot
Added tests for displayhook...
r21420 def test_output_displayed():
"""Checking to make sure that output is displayed"""
with AssertPrints('2'):
Matthias Bussonnier
pep8
r21425 ip.run_cell('1+1', store_history=True)
nottaanibot
Added tests for displayhook...
r21420
with AssertPrints('2'):
Matthias Bussonnier
pep8
r21425 ip.run_cell('1+1 # comment with a semicolon;', store_history=True)
Sebastian Bank
adapt DisplayHook.quiet() for multiline input
r22076
with AssertPrints('2'):
ip.run_cell('1+1\n#commented_out_function();', store_history=True)
nottaanibot
Added tests for displayhook...
r21420
def test_output_quiet():
"""Checking to make sure that output is quiet"""
with AssertNotPrints('2'):
Matthias Bussonnier
pep8
r21425 ip.run_cell('1+1;', store_history=True)
nottaanibot
Added tests for displayhook...
r21420
with AssertNotPrints('2'):
Matthias Bussonnier
pep8
r21425 ip.run_cell('1+1; # comment with a semicolon', store_history=True)
Sebastian Bank
adapt DisplayHook.quiet() for multiline input
r22076
with AssertNotPrints('2'):
ip.run_cell('1+1;\n#commented_out_function()', store_history=True)
Matthias Bussonnier
Do not update the unders if they are user defined...
r22838
def test_underscore_no_overrite_user():
ip.run_cell('_ = 42', store_history=True)
ip.run_cell('1+1', store_history=True)
with AssertPrints('42'):
ip.run_cell('print(_)', store_history=True)
ip.run_cell('del _', store_history=True)
ip.run_cell('6+6', store_history=True)
with AssertPrints('12'):
ip.run_cell('_', store_history=True)
def test_underscore_no_overrite_builtins():
ip.run_cell("import gettext ; gettext.install('foo')", store_history=True)
ip.run_cell('3+3', store_history=True)
with AssertPrints('gettext'):
ip.run_cell('print(_)', store_history=True)
ip.run_cell('_ = "userset"', store_history=True)
with AssertPrints('userset'):
ip.run_cell('print(_)', store_history=True)
ip.run_cell('import builtins; del builtins._')