From 6a9f4e526c25c17cfda38aa55159521b44aba383 2011-04-07 20:44:15 From: Thomas Kluyver Date: 2011-04-07 20:44:15 Subject: [PATCH] Fix core and lib tests so that all tests pass. --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index cac1697..0f778a1 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -2127,7 +2127,7 @@ class InteractiveShell(Configurable, Magic): with self.display_trap: try: - code_ast = ast.parse(cell) + code_ast = ast.parse(cell, filename=cell_name) except (OverflowError, SyntaxError, ValueError, TypeError, MemoryError): # Case 1 self.showsyntaxerror() diff --git a/IPython/core/tests/test_compilerop.py b/IPython/core/tests/test_compilerop.py index 2fac2fc..e9989db 100644 --- a/IPython/core/tests/test_compilerop.py +++ b/IPython/core/tests/test_compilerop.py @@ -40,12 +40,12 @@ def test_code_name2(): nt.assert_true(name.startswith(' ncache) def setUp(): @@ -53,10 +53,10 @@ def setUp(): # as GTK, can change the default encoding, which can hide bugs.) nt.assert_equal(sys.getdefaultencoding(), "ascii") -def test_compiler_unicode(): +def test_cache_unicode(): cp = compilerop.CachingCompiler() ncache = len(linecache.cache) - cp(u"t = 'žćčšđ'", "single") + cp.cache(u"t = 'žćčšđ'") nt.assert_true(len(linecache.cache) > ncache) def test_compiler_check_cache(): @@ -64,7 +64,7 @@ def test_compiler_check_cache(): """ # Rather simple-minded tests that just exercise the API cp = compilerop.CachingCompiler() - cp('x=1', 'single', 99) + cp.cache('x=1', 99) # Ensure now that after clearing the cache, our entries survive cp.check_cache() for k in linecache.cache: diff --git a/IPython/core/tests/test_handlers.py b/IPython/core/tests/test_handlers.py index c8a9c94..483a8d7 100644 --- a/IPython/core/tests/test_handlers.py +++ b/IPython/core/tests/test_handlers.py @@ -43,9 +43,7 @@ def run(tests): for pre, post in tests: global num_tests num_tests += 1 - ip.runlines(pre) - ip.runlines('_i') # Not sure why I need this... - actual = ip.user_ns['_i'] + actual = ip.prefilter_manager.prefilter_lines(pre) if actual != None: actual = actual.rstrip('\n') if actual != post: diff --git a/IPython/lib/tests/test_irunner.py b/IPython/lib/tests/test_irunner.py index dd8cfd3..1ca1f7a 100755 --- a/IPython/lib/tests/test_irunner.py +++ b/IPython/lib/tests/test_irunner.py @@ -97,10 +97,10 @@ In [7]: autocall 0 Automatic calling is: OFF In [8]: cos pi - File "", line 1 + File "", line 1 cos pi ^ -SyntaxError: invalid syntax +SyntaxError: unexpected EOF while parsing In [9]: cos(pi)