From a0136ae6c1ed7e7205e1114c615a8fee5ef55b42 2010-01-10 02:14:45 From: Fernando Perez Date: 2010-01-10 02:14:45 Subject: [PATCH] Make all non-twisted tests pass. Removed a test (builtins) that was already being done in test_run, fixed broken doctest and fixed prefilter handling for empty buffers. The only remaining failing test is now in twisted. --- diff --git a/IPython/core/prefilter.py b/IPython/core/prefilter.py index 029e921..8cf76ca 100755 --- a/IPython/core/prefilter.py +++ b/IPython/core/prefilter.py @@ -755,9 +755,17 @@ class PrefilterHandler(Component): line = line_info.line continue_prompt = line_info.continue_prompt - if (continue_prompt and self.shell.autoindent and line.isspace() and - (0 < abs(len(line) - self.shell.indent_current_nsp) <= 2 or - (self.shell.buffer[-1]).isspace() )): + if (continue_prompt and + self.shell.autoindent and + line.isspace() and + + (0 < abs(len(line) - self.shell.indent_current_nsp) <= 2 + or + not self.shell.buffer + or + (self.shell.buffer[-1]).isspace() + ) + ): line = '' self.shell.log(line, line, continue_prompt) diff --git a/IPython/testing/plugin/test_ipdoctest.py b/IPython/testing/plugin/test_ipdoctest.py index f5a6a4e..6d04b92 100644 --- a/IPython/testing/plugin/test_ipdoctest.py +++ b/IPython/testing/plugin/test_ipdoctest.py @@ -18,25 +18,6 @@ def doctest_simple(): """ -def doctest_run_builtins(): - """Check that %run doesn't damage __builtins__ via a doctest. - - This is similar to the test_run_builtins, but I want *both* forms of the - test to catch any possible glitches in our testing machinery, since that - modifies %run somewhat. So for this, we have both a normal test (below) - and a doctest (this one). - - In [1]: import tempfile - - In [3]: f = tempfile.NamedTemporaryFile() - - In [4]: f.write('pass\\n') - - In [5]: f.flush() - - In [7]: %run $f.name - """ - def doctest_multiline1(): """The ipdoctest machinery must handle multiline examples gracefully. diff --git a/IPython/testing/tests/test_ipunittest.py b/IPython/testing/tests/test_ipunittest.py index 3fbacc1..3df0230 100644 --- a/IPython/testing/tests/test_ipunittest.py +++ b/IPython/testing/tests/test_ipunittest.py @@ -103,7 +103,7 @@ class Foo(object): def ipdt_method(self): """ In [20]: print 1 - 2 + 1 In [26]: for i in range(10): ....: print i,