[IPython-dev] Interactive input block handling
Fernando Perez
fperez.net at gmail.com
Wed Jul 21 06:32:47 EDT 2010
Hi folks,
here:
http://github.com/fperez/ipython/commit/37182fcaaa893488c4655cd37049bb71b1f9152a
is the code that Evan can start using now (and so can Omar as we
refactor the terminal code) for properly handling incremental
interactive input. I ran out of time to add the block-splitting
capabilities for Gerardo, but that should be easy tomorrow.
It would be a good habit to get into for all new code, to attempt as
best as possible 100% test coverage:
(blockbreaker)amirbar[core]> nosetests -vvs --with-coverage
--cover-package=IPython.core.blockbreaker blockbreaker.py
test_dedent (IPython.core.blockbreaker.BlockBreakerTestCase) ... ok
test_indent (IPython.core.blockbreaker.BlockBreakerTestCase) ... ok
test_indent2 (IPython.core.blockbreaker.BlockBreakerTestCase) ... ok
test_interactive_block_ready
(IPython.core.blockbreaker.BlockBreakerTestCase) ... ok
test_interactive_block_ready2
(IPython.core.blockbreaker.BlockBreakerTestCase) ... ok
test_interactive_block_ready3
(IPython.core.blockbreaker.BlockBreakerTestCase) ... ok
test_interactive_block_ready4
(IPython.core.blockbreaker.BlockBreakerTestCase) ... ok
test_push (IPython.core.blockbreaker.BlockBreakerTestCase) ... ok
test_push2 (IPython.core.blockbreaker.BlockBreakerTestCase) ... ok
Test input with leading whitespace ... ok
test_reset (IPython.core.blockbreaker.BlockBreakerTestCase) ... ok
test_source (IPython.core.blockbreaker.BlockBreakerTestCase) ... ok
IPython.core.blockbreaker.test_spaces ... ok
IPython.core.blockbreaker.test_remove_comments ... ok
IPython.core.blockbreaker.test_get_input_encoding ... ok
Name Stmts Exec Cover Missing
---------------------------------------------------------
IPython.core.blockbreaker 171 171 100%
----------------------------------------------------------------------
Ran 15 tests in 0.022s
OK
###
In this case it actually helped me a lot, because in going from ~85%
to 100% I actually found that the untested codepaths were indeed
buggy. As the saying goes, 'untested code is broken code'...
Cheers,
f
More information about the IPython-dev
mailing list