from IPython import get_ipython
from IPython.testing import tools as tt
from IPython.terminal.interactiveshell import TerminalInteractiveShell


def test_full_cycle():
    shell = TerminalInteractiveShell.instance()
    ip = get_ipython()

    with tt.AssertPrints('time: '):
        ip.run_cell("%load_ext autotime")

    with tt.AssertPrints('time: '):
        ip.run_cell("x = 1")

    with tt.AssertPrints(''):
        ip.run_cell("%unload_ext autotime")

from IPython import get_ipython
from IPython.testing import tools as tt
from IPython.terminal.interactiveshell import TerminalInteractiveShell


def test_full_cycle():
    shell = TerminalInteractiveShell.instance()
    ip = get_ipython()

    with tt.AssertPrints('time: '):
        ip.run_cell('%load_ext autotime')

    with tt.AssertPrints('time: '):
        ip.run_cell('x = 1')

    with tt.AssertNotPrints('time: '):
        ip.run_cell('%unload_ext autotime')

Make unload test assertion explicit
Make unload test assertion explicit
  from IPython import get_ipython
  from IPython.testing import tools as tt
  from IPython.terminal.interactiveshell import TerminalInteractiveShell
  
  
  def test_full_cycle():
      shell = TerminalInteractiveShell.instance()
      ip = get_ipython()
  
      with tt.AssertPrints('time: '):
-         ip.run_cell("%load_ext autotime")
+         ip.run_cell('%load_ext autotime')
  
      with tt.AssertPrints('time: '):
-         ip.run_cell("x = 1")
+         ip.run_cell('x = 1')
  
-     with tt.AssertPrints(''):
+     with tt.AssertNotPrints('time: '):
-         ip.run_cell("%unload_ext autotime")
+         ip.run_cell('%unload_ext autotime')
  
Make unload test assertion explicit
## Code Before:
from IPython import get_ipython
from IPython.testing import tools as tt
from IPython.terminal.interactiveshell import TerminalInteractiveShell


def test_full_cycle():
    shell = TerminalInteractiveShell.instance()
    ip = get_ipython()

    with tt.AssertPrints('time: '):
        ip.run_cell("%load_ext autotime")

    with tt.AssertPrints('time: '):
        ip.run_cell("x = 1")

    with tt.AssertPrints(''):
        ip.run_cell("%unload_ext autotime")

## Instruction:
Make unload test assertion explicit
## Code After:
from IPython import get_ipython
from IPython.testing import tools as tt
from IPython.terminal.interactiveshell import TerminalInteractiveShell


def test_full_cycle():
    shell = TerminalInteractiveShell.instance()
    ip = get_ipython()

    with tt.AssertPrints('time: '):
        ip.run_cell('%load_ext autotime')

    with tt.AssertPrints('time: '):
        ip.run_cell('x = 1')

    with tt.AssertNotPrints('time: '):
        ip.run_cell('%unload_ext autotime')
