##// END OF EJS Templates
_replace_rlhist_multiline: check if remove_history_item is available
Julian Taylor -
Show More
@@ -236,6 +236,10 b' class TerminalInteractiveShell(InteractiveShell):'
236 if not self.has_readline or not self.multiline_history:
236 if not self.has_readline or not self.multiline_history:
237 return hlen_before_cell
237 return hlen_before_cell
238
238
239 # windows rl has no remove_history_item
240 if not hasattr(self.readline, "remove_history_item"):
241 return hlen_before_cell
242
239 # skip empty cells
243 # skip empty cells
240 if not source_raw.rstrip():
244 if not source_raw.rstrip():
241 return hlen_before_cell
245 return hlen_before_cell
@@ -34,6 +34,14 b' class InteractiveShellTestCase(unittest.TestCase):'
34 ip._replace_rlhist_multiline(u'source', 0)
34 ip._replace_rlhist_multiline(u'source', 0)
35
35
36 @skipif(not get_ipython().has_readline, 'no readline')
36 @skipif(not get_ipython().has_readline, 'no readline')
37 def test_runs_without_remove_history_item(self):
38 """Test that function does not throw on windows without
39 remove_history_item"""
40 ip = get_ipython()
41 del ip.readline.remove_history_item
42 ip._replace_rlhist_multiline(u'source', 0)
43
44 @skipif(not get_ipython().has_readline, 'no readline')
37 def test_replace_multiline_hist_disabled(self):
45 def test_replace_multiline_hist_disabled(self):
38 """Test that multiline replace does nothing if disabled"""
46 """Test that multiline replace does nothing if disabled"""
39 ip = get_ipython()
47 ip = get_ipython()
General Comments 0
You need to be logged in to leave comments. Login now