##// END OF EJS Templates
fix test
Matthias Bussonnier -
Show More
@@ -601,6 +601,8 b' Defaulting color scheme to \'NoColor\'"""'
601 if args.export:
601 if args.export:
602 cells = []
602 cells = []
603 hist = list(self.shell.history_manager.get_range())
603 hist = list(self.shell.history_manager.get_range())
604 if(len(hist)<=1):
605 raise ValueError('History is empty, cannot export')
604 for session, execution_count, input in hist[:-1]:
606 for session, execution_count, input in hist[:-1]:
605 cells.append(v4.new_code_cell(
607 cells.append(v4.new_code_cell(
606 execution_count=execution_count,
608 execution_count=execution_count,
@@ -623,9 +623,13 b' def test_extension():'
623 @skipIf(dec.module_not_available('IPython.nbformat'), 'nbformat not importable')
623 @skipIf(dec.module_not_available('IPython.nbformat'), 'nbformat not importable')
624 class NotebookExportMagicTests(TestCase):
624 class NotebookExportMagicTests(TestCase):
625 def test_notebook_export_json(self):
625 def test_notebook_export_json(self):
626 _ip = get_ipython()
627 _ip.history_manager.reset() # Clear any existing history.
628 cmds = [u"a=1", u"def b():\n return a**2", u"print(a, b())"]
629 for i, cmd in enumerate(cmds, start=1):
630 _ip.history_manager.store_inputs(i, cmd)
626 with TemporaryDirectory() as td:
631 with TemporaryDirectory() as td:
627 outfile = os.path.join(td, "nb.ipynb")
632 outfile = os.path.join(td, "nb.ipynb")
628 _ip.ex(py3compat.u_format(u"u = {u}'héllo'"))
629 _ip.magic("notebook -e %s" % outfile)
633 _ip.magic("notebook -e %s" % outfile)
630
634
631
635
General Comments 0
You need to be logged in to leave comments. Login now