Show More
@@ -211,7 +211,7 def test_clear(): | |||
|
211 | 211 | nt.assert_true('parrot' in [_ip.user_ns[x] for x in '_i','_ii','_iii']) |
|
212 | 212 | _ip.magic('%clear in') |
|
213 | 213 | nt.assert_false('parrot' in [_ip.user_ns[x] for x in '_i','_ii','_iii']) |
|
214 |
nt.assert_true(len(_ip.user_ns['In']) == |
|
|
214 | nt.assert_true(len(set(_ip.user_ns['In'])) == 1) | |
|
215 | 215 | |
|
216 | 216 | # test '%clear dhist' |
|
217 | 217 | _ip.run_cell("tmp = [d for d in _dh]") # copy before clearing |
@@ -222,6 +222,11 def test_clear(): | |||
|
222 | 222 | nt.assert_true(len(_ip.user_ns['_dh']) == 0) |
|
223 | 223 | _ip.run_cell("_dh = [d for d in tmp]") #restore |
|
224 | 224 | |
|
225 | # test that In length is preserved for %macro | |
|
226 | _ip.run_cell("print 'foo'") | |
|
227 | _ip.run_cell("clear in") | |
|
228 | nt.assert_true(len(_ip.user_ns['In']) == _ip.displayhook.prompt_count+1) | |
|
229 | ||
|
225 | 230 | def test_time(): |
|
226 | 231 | _ip.magic('time None') |
|
227 | 232 |
@@ -45,8 +45,10 def clear_f(self,arg): | |||
|
45 | 45 | key = '_i'+repr(n) |
|
46 | 46 | user_ns.pop(key,None) |
|
47 | 47 | user_ns.update(dict(_i=u'',_ii=u'',_iii=u'')) |
|
48 | del self.history_manager.input_hist_parsed[:] | |
|
49 | del self.history_manager.input_hist_raw[:] | |
|
48 | # don't delete these, as %save and %macro depending on the length | |
|
49 | # of these lists to be preserved | |
|
50 | self.history_manager.input_hist_parsed[:] = [''] * pc | |
|
51 | self.history_manager.input_hist_raw[:] = [''] * pc | |
|
50 | 52 | |
|
51 | 53 | elif target == 'array': |
|
52 | 54 | # Support cleaning up numpy arrays |
General Comments 0
You need to be logged in to leave comments.
Login now