Show More
@@ -142,7 +142,7 b' class InputSplitterTestCase(unittest.TestCase):' | |||
|
142 | 142 | self.isp._store('1') |
|
143 | 143 | self.isp._store('2') |
|
144 | 144 | self.assertEqual(self.isp.source, '1\n2\n') |
|
145 |
self.assert |
|
|
145 | self.assertEqual(len(self.isp._buffer)>0, True) | |
|
146 | 146 | self.assertEqual(self.isp.source_reset(), '1\n2\n') |
|
147 | 147 | self.assertEqual(self.isp._buffer, []) |
|
148 | 148 | self.assertEqual(self.isp.source, '') |
@@ -244,39 +244,39 b' class InputSplitterTestCase(unittest.TestCase):' | |||
|
244 | 244 | |
|
245 | 245 | def test_push(self): |
|
246 | 246 | isp = self.isp |
|
247 |
self.assert |
|
|
247 | self.assertEqual(isp.push('x=1'), True) | |
|
248 | 248 | |
|
249 | 249 | def test_push2(self): |
|
250 | 250 | isp = self.isp |
|
251 |
self.assert |
|
|
251 | self.assertEqual(isp.push('if 1:'), False) | |
|
252 | 252 | for line in [' x=1', '# a comment', ' y=2']: |
|
253 | 253 | print(line) |
|
254 |
self.assert |
|
|
254 | self.assertEqual(isp.push(line), True) | |
|
255 | 255 | |
|
256 | 256 | def test_push3(self): |
|
257 | 257 | isp = self.isp |
|
258 | 258 | isp.push('if True:') |
|
259 | 259 | isp.push(' a = 1') |
|
260 |
self.assert |
|
|
260 | self.assertEqual(isp.push('b = [1,'), False) | |
|
261 | 261 | |
|
262 | 262 | def test_push_accepts_more(self): |
|
263 | 263 | isp = self.isp |
|
264 | 264 | isp.push('x=1') |
|
265 |
self.assert |
|
|
265 | self.assertEqual(isp.push_accepts_more(), False) | |
|
266 | 266 | |
|
267 | 267 | def test_push_accepts_more2(self): |
|
268 | 268 | isp = self.isp |
|
269 | 269 | isp.push('if 1:') |
|
270 |
self.assert |
|
|
270 | self.assertEqual(isp.push_accepts_more(), True) | |
|
271 | 271 | isp.push(' x=1') |
|
272 |
self.assert |
|
|
272 | self.assertEqual(isp.push_accepts_more(), True) | |
|
273 | 273 | isp.push('') |
|
274 |
self.assert |
|
|
274 | self.assertEqual(isp.push_accepts_more(), False) | |
|
275 | 275 | |
|
276 | 276 | def test_push_accepts_more3(self): |
|
277 | 277 | isp = self.isp |
|
278 | 278 | isp.push("x = (2+\n3)") |
|
279 |
self.assert |
|
|
279 | self.assertEqual(isp.push_accepts_more(), False) | |
|
280 | 280 | |
|
281 | 281 | def test_push_accepts_more4(self): |
|
282 | 282 | isp = self.isp |
@@ -290,11 +290,11 b' class InputSplitterTestCase(unittest.TestCase):' | |||
|
290 | 290 | isp.push("if 1:") |
|
291 | 291 | isp.push(" x = (2+") |
|
292 | 292 | isp.push(" 3)") |
|
293 |
self.assert |
|
|
293 | self.assertEqual(isp.push_accepts_more(), True) | |
|
294 | 294 | isp.push(" y = 3") |
|
295 |
self.assert |
|
|
295 | self.assertEqual(isp.push_accepts_more(), True) | |
|
296 | 296 | isp.push('') |
|
297 |
self.assert |
|
|
297 | self.assertEqual(isp.push_accepts_more(), False) | |
|
298 | 298 | |
|
299 | 299 | def test_push_accepts_more5(self): |
|
300 | 300 | isp = self.isp |
@@ -304,14 +304,14 b' class InputSplitterTestCase(unittest.TestCase):' | |||
|
304 | 304 | isp.push(' raise') |
|
305 | 305 | # We want to be able to add an else: block at this point, so it should |
|
306 | 306 | # wait for a blank line. |
|
307 |
self.assert |
|
|
307 | self.assertEqual(isp.push_accepts_more(), True) | |
|
308 | 308 | |
|
309 | 309 | def test_continuation(self): |
|
310 | 310 | isp = self.isp |
|
311 | 311 | isp.push("import os, \\") |
|
312 |
self.assert |
|
|
312 | self.assertEqual(isp.push_accepts_more(), True) | |
|
313 | 313 | isp.push("sys") |
|
314 |
self.assert |
|
|
314 | self.assertEqual(isp.push_accepts_more(), False) | |
|
315 | 315 | |
|
316 | 316 | def test_syntax_error(self): |
|
317 | 317 | isp = self.isp |
@@ -319,7 +319,7 b' class InputSplitterTestCase(unittest.TestCase):' | |||
|
319 | 319 | # Python can be sent to the kernel for evaluation with possible ipython |
|
320 | 320 | # special-syntax conversion. |
|
321 | 321 | isp.push('run foo') |
|
322 |
self.assert |
|
|
322 | self.assertEqual(isp.push_accepts_more(), False) | |
|
323 | 323 | |
|
324 | 324 | def test_unicode(self): |
|
325 | 325 | self.isp.push(u"Pérez") |
@@ -331,16 +331,16 b' class InputSplitterTestCase(unittest.TestCase):' | |||
|
331 | 331 | isp = self.isp |
|
332 | 332 | # A blank line after a line continuation should not accept more |
|
333 | 333 | isp.push("1 \\\n\n") |
|
334 |
self.assert |
|
|
334 | self.assertEqual(isp.push_accepts_more(), False) | |
|
335 | 335 | # Whitespace after a \ is a SyntaxError. The only way to test that |
|
336 | 336 | # here is to test that push doesn't accept more (as with |
|
337 | 337 | # test_syntax_error() above). |
|
338 | 338 | isp.push(r"1 \ ") |
|
339 |
self.assert |
|
|
339 | self.assertEqual(isp.push_accepts_more(), False) | |
|
340 | 340 | # Even if the line is continuable (c.f. the regular Python |
|
341 | 341 | # interpreter) |
|
342 | 342 | isp.push(r"(1 \ ") |
|
343 |
self.assert |
|
|
343 | self.assertEqual(isp.push_accepts_more(), False) | |
|
344 | 344 | |
|
345 | 345 | def test_check_complete(self): |
|
346 | 346 | isp = self.isp |
General Comments 0
You need to be logged in to leave comments.
Login now