##// END OF EJS Templates
Add empty histrange `%save` test
Blazej Michalik -
Show More
@@ -1089,6 +1089,29 b' def test_save():'
1089 nt.assert_in("coding: utf-8", content)
1089 nt.assert_in("coding: utf-8", content)
1090
1090
1091
1091
1092 def test_save_with_no_args():
1093 ip = get_ipython()
1094 ip.history_manager.reset() # Clear any existing history.
1095 cmds = [u"a=1", u"def b():\n return a**2", u"print(a, b())", "%save"]
1096 for i, cmd in enumerate(cmds, start=1):
1097 ip.history_manager.store_inputs(i, cmd)
1098
1099 with TemporaryDirectory() as tmpdir:
1100 path = os.path.join(tmpdir, "testsave.py")
1101 ip.run_line_magic("save", path)
1102 content = Path(path).read_text()
1103 expected_content = dedent(
1104 """\
1105 # coding: utf-8
1106 a=1
1107 def b():
1108 return a**2
1109 print(a, b())
1110 """
1111 )
1112 nt.assert_equal(content, expected_content)
1113
1114
1092 def test_store():
1115 def test_store():
1093 """Test %store."""
1116 """Test %store."""
1094 ip = get_ipython()
1117 ip = get_ipython()
General Comments 0
You need to be logged in to leave comments. Login now