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