Show More
@@ -26,6 +26,7 b' from __future__ import print_function' | |||||
26 | import sys |
|
26 | import sys | |
27 |
|
27 | |||
28 | from IPython.core.formatters import _safe_get_formatter_method |
|
28 | from IPython.core.formatters import _safe_get_formatter_method | |
|
29 | from IPython.core import inputsplitter | |||
29 | from IPython.config.configurable import Configurable |
|
30 | from IPython.config.configurable import Configurable | |
30 | from IPython.utils import io |
|
31 | from IPython.utils import io | |
31 | from IPython.utils.py3compat import builtin_mod |
|
32 | from IPython.utils.py3compat import builtin_mod | |
@@ -100,12 +101,10 b' class DisplayHook(Configurable):' | |||||
100 | # do not print output if input ends in ';' |
|
101 | # do not print output if input ends in ';' | |
101 | try: |
|
102 | try: | |
102 | cell = self.shell.history_manager.input_hist_parsed[self.prompt_count] |
|
103 | cell = self.shell.history_manager.input_hist_parsed[self.prompt_count] | |
103 |
|
|
104 | return inputsplitter.remove_comments(cell).rstrip().endswith(';') | |
104 | return True |
|
|||
105 | except IndexError: |
|
105 | except IndexError: | |
106 | # some uses of ipshellembed may fail here |
|
106 | # some uses of ipshellembed may fail here | |
107 |
|
|
107 | return False | |
108 | return False |
|
|||
109 |
|
108 | |||
110 | def start_displayhook(self): |
|
109 | def start_displayhook(self): | |
111 | """Start the displayhook, initializing resources.""" |
|
110 | """Start the displayhook, initializing resources.""" |
@@ -98,13 +98,17 b' class InteractiveShellTestCase(unittest.TestCase):' | |||||
98 | def test_dont_cache_with_semicolon(self): |
|
98 | def test_dont_cache_with_semicolon(self): | |
99 | "Ending a line with semicolon should not cache the returned object (GH-307)" |
|
99 | "Ending a line with semicolon should not cache the returned object (GH-307)" | |
100 | oldlen = len(ip.user_ns['Out']) |
|
100 | oldlen = len(ip.user_ns['Out']) | |
101 | a = ip.run_cell('1;', store_history=True) |
|
101 | for cell in ['1;', '1; #a', '1;1;']: | |
102 | newlen = len(ip.user_ns['Out']) |
|
102 | ip.run_cell(cell, store_history=True) | |
103 | self.assertEqual(oldlen, newlen) |
|
103 | newlen = len(ip.user_ns['Out']) | |
|
104 | self.assertEqual(oldlen, newlen) | |||
|
105 | i = 0 | |||
104 | #also test the default caching behavior |
|
106 | #also test the default caching behavior | |
105 | ip.run_cell('1', store_history=True) |
|
107 | for cell in ['1', '1 #;', '1;1']: | |
106 | newlen = len(ip.user_ns['Out']) |
|
108 | ip.run_cell(cell, store_history=True) | |
107 | self.assertEqual(oldlen+1, newlen) |
|
109 | newlen = len(ip.user_ns['Out']) | |
|
110 | i += 1 | |||
|
111 | self.assertEqual(oldlen+i, newlen) | |||
108 |
|
112 | |||
109 | def test_In_variable(self): |
|
113 | def test_In_variable(self): | |
110 | "Verify that In variable grows with user input (GH-284)" |
|
114 | "Verify that In variable grows with user input (GH-284)" |
General Comments 0
You need to be logged in to leave comments.
Login now