Show More
@@ -2127,7 +2127,7 b' class InteractiveShell(Configurable, Magic):' | |||
|
2127 | 2127 | |
|
2128 | 2128 | with self.display_trap: |
|
2129 | 2129 | try: |
|
2130 | code_ast = ast.parse(cell) | |
|
2130 | code_ast = ast.parse(cell, filename=cell_name) | |
|
2131 | 2131 | except (OverflowError, SyntaxError, ValueError, TypeError, MemoryError): |
|
2132 | 2132 | # Case 1 |
|
2133 | 2133 | self.showsyntaxerror() |
@@ -40,12 +40,12 b' def test_code_name2():' | |||
|
40 | 40 | nt.assert_true(name.startswith('<ipython-input-9')) |
|
41 | 41 | |
|
42 | 42 | |
|
43 |
def test_c |
|
|
43 | def test_cache(): | |
|
44 | 44 | """Test the compiler correctly compiles and caches inputs |
|
45 | 45 | """ |
|
46 | 46 | cp = compilerop.CachingCompiler() |
|
47 | 47 | ncache = len(linecache.cache) |
|
48 |
cp('x=1' |
|
|
48 | cp.cache('x=1') | |
|
49 | 49 | nt.assert_true(len(linecache.cache) > ncache) |
|
50 | 50 | |
|
51 | 51 | def setUp(): |
@@ -53,10 +53,10 b' def setUp():' | |||
|
53 | 53 | # as GTK, can change the default encoding, which can hide bugs.) |
|
54 | 54 | nt.assert_equal(sys.getdefaultencoding(), "ascii") |
|
55 | 55 | |
|
56 |
def test_c |
|
|
56 | def test_cache_unicode(): | |
|
57 | 57 | cp = compilerop.CachingCompiler() |
|
58 | 58 | ncache = len(linecache.cache) |
|
59 |
cp(u"t = 'žćčšđ'" |
|
|
59 | cp.cache(u"t = 'žćčšđ'") | |
|
60 | 60 | nt.assert_true(len(linecache.cache) > ncache) |
|
61 | 61 | |
|
62 | 62 | def test_compiler_check_cache(): |
@@ -64,7 +64,7 b' def test_compiler_check_cache():' | |||
|
64 | 64 | """ |
|
65 | 65 | # Rather simple-minded tests that just exercise the API |
|
66 | 66 | cp = compilerop.CachingCompiler() |
|
67 |
cp('x=1', |
|
|
67 | cp.cache('x=1', 99) | |
|
68 | 68 | # Ensure now that after clearing the cache, our entries survive |
|
69 | 69 | cp.check_cache() |
|
70 | 70 | for k in linecache.cache: |
@@ -43,9 +43,7 b' def run(tests):' | |||
|
43 | 43 | for pre, post in tests: |
|
44 | 44 | global num_tests |
|
45 | 45 | num_tests += 1 |
|
46 | ip.runlines(pre) | |
|
47 | ip.runlines('_i') # Not sure why I need this... | |
|
48 | actual = ip.user_ns['_i'] | |
|
46 | actual = ip.prefilter_manager.prefilter_lines(pre) | |
|
49 | 47 | if actual != None: |
|
50 | 48 | actual = actual.rstrip('\n') |
|
51 | 49 | if actual != post: |
@@ -97,10 +97,10 b' In [7]: autocall 0' | |||
|
97 | 97 | Automatic calling is: OFF |
|
98 | 98 | |
|
99 | 99 | In [8]: cos pi |
|
100 |
File "<ipython-input-8- |
|
|
100 | File "<ipython-input-8-586f1104ea44>", line 1 | |
|
101 | 101 | cos pi |
|
102 | 102 | ^ |
|
103 | SyntaxError: invalid syntax | |
|
103 | SyntaxError: unexpected EOF while parsing | |
|
104 | 104 | |
|
105 | 105 | |
|
106 | 106 | In [9]: cos(pi) |
General Comments 0
You need to be logged in to leave comments.
Login now