Show More
@@ -306,7 +306,7 b' class IPythonCocoaController(NSObject, FrontEndBase):' | |||
|
306 | 306 | |
|
307 | 307 | def update_cell_prompt(self, result): |
|
308 | 308 | blockID = result['blockID'] |
|
309 |
self.insert_text(self.input |
|
|
309 | self.insert_text(self.input_prompt(result=result), | |
|
310 | 310 | textRange=NSMakeRange(self.blockRanges[blockID].location,0), |
|
311 | 311 | scrollToVisible=False |
|
312 | 312 | ) |
@@ -321,7 +321,7 b' class IPythonCocoaController(NSObject, FrontEndBase):' | |||
|
321 | 321 | |
|
322 | 322 | #print inputRange,self.currentBlockRange() |
|
323 | 323 | self.insert_text('\n' + |
|
324 |
self.output |
|
|
324 | self.output_prompt(result) + | |
|
325 | 325 | result.get('display',{}).get('pprint','') + |
|
326 | 326 | '\n\n', |
|
327 | 327 | textRange=NSMakeRange(inputRange.location+inputRange.length, 0)) |
@@ -89,16 +89,16 b' class IFrontEnd(zi.Interface):' | |||
|
89 | 89 | pass |
|
90 | 90 | |
|
91 | 91 | |
|
92 |
def input |
|
|
92 | def input_prompt(result={}): | |
|
93 | 93 | """Returns the input prompt by subsituting into self.input_prompt_template""" |
|
94 | 94 | pass |
|
95 | 95 | |
|
96 |
def output |
|
|
96 | def output_prompt(result): | |
|
97 | 97 | """Returns the output prompt by subsituting into self.output_prompt_template""" |
|
98 | 98 | |
|
99 | 99 | pass |
|
100 | 100 | |
|
101 |
def continuation |
|
|
101 | def continuation_prompt(): | |
|
102 | 102 | """Returns the continuation prompt by subsituting into self.continuation_prompt_template""" |
|
103 | 103 | |
|
104 | 104 | pass |
@@ -157,7 +157,7 b' class FrontEndBase(object):' | |||
|
157 | 157 | self.history = history |
|
158 | 158 | |
|
159 | 159 | |
|
160 |
def input |
|
|
160 | def input_prompt(self, result={}): | |
|
161 | 161 | """Returns the current input prompt |
|
162 | 162 | |
|
163 | 163 | It would be great to use ipython1.core.prompts.Prompt1 here |
@@ -168,12 +168,12 b' class FrontEndBase(object):' | |||
|
168 | 168 | return self.input_prompt_template.safe_substitute(result) |
|
169 | 169 | |
|
170 | 170 | |
|
171 |
def continuation |
|
|
171 | def continuation_prompt(self): | |
|
172 | 172 | """Returns the current continuation prompt""" |
|
173 | 173 | |
|
174 | 174 | return self.continuation_prompt_template.safe_substitute() |
|
175 | 175 | |
|
176 |
def output |
|
|
176 | def output_prompt(self, result): | |
|
177 | 177 | """Returns the output prompt for result""" |
|
178 | 178 | |
|
179 | 179 | return self.output_prompt_template.safe_substitute(result) |
@@ -50,18 +50,18 b' class TestFrontendBase(unittest.TestCase):' | |||
|
50 | 50 | self.fb = FrontEndCallbackChecker(engine=EngineService()) |
|
51 | 51 | |
|
52 | 52 | |
|
53 | def test_implementsIFrontEnd(self): | |
|
53 | def test_implements_IFrontEnd(self): | |
|
54 | 54 | assert(frontendbase.IFrontEnd.implementedBy(frontendbase.FrontEndBase)) |
|
55 | 55 | |
|
56 | 56 | |
|
57 |
def test_is_complete |
|
|
57 | def test_is_complete_returns_False_for_incomplete_block(self): | |
|
58 | 58 | """""" |
|
59 | 59 | |
|
60 | 60 | block = """def test(a):""" |
|
61 | 61 | |
|
62 | 62 | assert(self.fb.is_complete(block) == False) |
|
63 | 63 | |
|
64 |
def test_is_complete |
|
|
64 | def test_is_complete_returns_True_for_complete_block(self): | |
|
65 | 65 | """""" |
|
66 | 66 | |
|
67 | 67 | block = """def test(a): pass""" |
@@ -73,7 +73,7 b' class TestFrontendBase(unittest.TestCase):' | |||
|
73 | 73 | assert(self.fb.is_complete(block)) |
|
74 | 74 | |
|
75 | 75 | |
|
76 |
def test_blockID |
|
|
76 | def test_blockID_added_to_result(self): | |
|
77 | 77 | block = """3+3""" |
|
78 | 78 | |
|
79 | 79 | d = self.fb.execute(block, blockID='TEST_ID') |
@@ -84,7 +84,7 b' class TestFrontendBase(unittest.TestCase):' | |||
|
84 | 84 | assert(result['blockID'] == expected) |
|
85 | 85 | |
|
86 | 86 | |
|
87 |
def test_callbacks |
|
|
87 | def test_callbacks_added_to_execute(self): | |
|
88 | 88 | """test that |
|
89 | 89 | update_cell_prompt |
|
90 | 90 | render_result |
@@ -101,7 +101,7 b' class TestFrontendBase(unittest.TestCase):' | |||
|
101 | 101 | assert(self.fb.renderResultCalled) |
|
102 | 102 | |
|
103 | 103 | |
|
104 |
def test_error |
|
|
104 | def test_error_callback_added_to_execute(self): | |
|
105 | 105 | """test that render_error called on execution error""" |
|
106 | 106 | |
|
107 | 107 | d = self.fb.execute("raise Exception()") |
General Comments 0
You need to be logged in to leave comments.
Login now