Show More
@@ -2378,6 +2378,10 b' class InteractiveShell(Component, Magic):' | |||
|
2378 | 2378 | |
|
2379 | 2379 | def init_prefilter(self): |
|
2380 | 2380 | self.prefilter_manager = PrefilterManager(self, config=self.config) |
|
2381 | # Ultimately this will be refactored in the new interpreter code, but | |
|
2382 | # for now, we should expose the main prefilter method (there's legacy | |
|
2383 | # code out there that may rely on this). | |
|
2384 | self.prefilter = self.prefilter_manager.prefilter_lines | |
|
2381 | 2385 | |
|
2382 | 2386 | #------------------------------------------------------------------------- |
|
2383 | 2387 | # Utilities |
@@ -11,7 +11,6 b' from cStringIO import StringIO' | |||
|
11 | 11 | |
|
12 | 12 | import nose.tools as nt |
|
13 | 13 | |
|
14 | #from IPython.core.iplib import get_ipython | |
|
15 | 14 | from IPython.utils.platutils import find_cmd, get_long_path_name |
|
16 | 15 | from IPython.testing import decorators as dec |
|
17 | 16 | from IPython.testing import tools as tt |
@@ -270,6 +269,7 b' class TestMagicRun(object):' | |||
|
270 | 269 | pass |
|
271 | 270 | |
|
272 | 271 | # Multiple tests for clipboard pasting |
|
272 | @dec.parametric | |
|
273 | 273 | def test_paste(): |
|
274 | 274 | _ip = get_ipython() |
|
275 | 275 | def paste(txt, flags='-q'): |
@@ -291,11 +291,11 b' def test_paste():' | |||
|
291 | 291 | # Run tests with fake clipboard function |
|
292 | 292 | user_ns.pop('x', None) |
|
293 | 293 | paste('x=1') |
|
294 |
yield |
|
|
294 | yield nt.assert_equal(user_ns['x'], 1) | |
|
295 | 295 | |
|
296 | 296 | user_ns.pop('x', None) |
|
297 | 297 | paste('>>> x=2') |
|
298 |
yield |
|
|
298 | yield nt.assert_equal(user_ns['x'], 2) | |
|
299 | 299 | |
|
300 | 300 | paste(""" |
|
301 | 301 | >>> x = [1,2,3] |
@@ -304,14 +304,14 b' def test_paste():' | |||
|
304 | 304 | ... y.append(i**2) |
|
305 | 305 | ... |
|
306 | 306 | """) |
|
307 |
yield |
|
|
308 |
yield |
|
|
307 | yield nt.assert_equal(user_ns['x'], [1,2,3]) | |
|
308 | yield nt.assert_equal(user_ns['y'], [1,4,9]) | |
|
309 | 309 | |
|
310 | 310 | # Now, test that paste -r works |
|
311 | 311 | user_ns.pop('x', None) |
|
312 |
yield |
|
|
312 | yield nt.assert_false('x' in user_ns) | |
|
313 | 313 | _ip.magic('paste -r') |
|
314 |
yield |
|
|
314 | yield nt.assert_equal(user_ns['x'], [1,2,3]) | |
|
315 | 315 | |
|
316 | 316 | # Also test paste echoing, by temporarily faking the writer |
|
317 | 317 | w = StringIO() |
@@ -325,12 +325,23 b' def test_paste():' | |||
|
325 | 325 | out = w.getvalue() |
|
326 | 326 | finally: |
|
327 | 327 | _ip.write = writer |
|
328 |
yield |
|
|
329 |
yield |
|
|
330 |
yield |
|
|
328 | yield nt.assert_equal(user_ns['a'], 100) | |
|
329 | yield nt.assert_equal(user_ns['b'], 200) | |
|
330 | yield nt.assert_equal(out, code+"\n## -- End pasted text --\n") | |
|
331 | 331 | |
|
332 | 332 | finally: |
|
333 | 333 | # This should be in a finally clause, instead of the bare except above. |
|
334 | 334 | # Restore original hook |
|
335 | 335 | hooks.clipboard_get = original_clip |
|
336 | 336 | |
|
337 | ||
|
338 | def test_time(): | |
|
339 | _ip.magic('time None') | |
|
340 | ||
|
341 | ||
|
342 | def doctest_time(): | |
|
343 | """ | |
|
344 | In [10]: %time None | |
|
345 | CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s | |
|
346 | Wall time: 0.00 s | |
|
347 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now