##// END OF EJS Templates
Improvements to exception handling to transport structured tracebacks....
Improvements to exception handling to transport structured tracebacks. This code is still fairly hackish, but we're starting to get there. We still need to improve the api, because right now runlines() does way too much, and I had to set the exception state in a temporary private variable. But client-side things are working better, so we can continue fixing the kernel without bottlenecking Evan.

File last commit:

r2365:10038790
r2838:cbe60016
Show More
test_completer.py
35 lines | 1.1 KiB | text/x-python | PythonLexer
"""Tests for the IPython tab-completion machinery.
"""
#-----------------------------------------------------------------------------
# Module imports
#-----------------------------------------------------------------------------
# stdlib
import sys
# third party
import nose.tools as nt
# our own packages
from IPython.core import completer
#-----------------------------------------------------------------------------
# Test functions
#-----------------------------------------------------------------------------
def test_protect_filename():
pairs = [ ('abc','abc'),
(' abc',r'\ abc'),
('a bc',r'a\ bc'),
('a bc',r'a\ \ bc'),
(' bc',r'\ \ bc'),
]
# On posix, we also protect parens
if sys.platform != 'win32':
pairs.extend( [('a(bc',r'a\(bc'),
('a)bc',r'a\)bc'),
('a( )bc',r'a\(\ \)bc'),
] )
# run the actual tests
for s1, s2 in pairs:
s1p = completer.protect_filename(s1)
nt.assert_equals(s1p, s2)