##// END OF EJS Templates
Fully refactored subprocess handling on all platforms....
Fully refactored subprocess handling on all platforms. Now we have all process-related code in utils.process, which itself imports from platform-specific files as needed. On posix, we have reliable asynchronous delivery of stdout and stderr, and on win32 at least we have the basics that subprocess.py provides, since pexpect is not available. We also now support robust killing of subprocesses that may capture SIGINT: one SIGINT on our end is sent to the subprocess, but then we kill it, to prevent a rogue subprocess from hijacking the ipython console. Note that on posix, we now depend on pexpect, but we ship our own copy to users which we'll use if there's no system pexpect installed. UNC path handling for windows was implemented as a context manager called AvoidUNCPath.

File last commit:

r2640:93949c91
r2908:06dcbd43
Show More
test_completion_lexer.py
47 lines | 1.4 KiB | text/x-python | PythonLexer
/ IPython / frontend / qt / console / tests / test_completion_lexer.py
epatters
Adding unit tests for Qt console frontend.
r2605 # Standard library imports
import unittest
# System library imports
from pygments.lexers import CLexer, CppLexer, PythonLexer
# Local imports
from IPython.frontend.qt.console.completion_lexer import CompletionLexer
class TestCompletionLexer(unittest.TestCase):
def testPython(self):
""" Does the CompletionLexer work for Python?
"""
lexer = CompletionLexer(PythonLexer())
epatters
* Fixed bug in CompletionLexer where a context would be generated for, e.g, 'foo('....
r2640 # Test simplest case.
epatters
Adding unit tests for Qt console frontend.
r2605 self.assertEquals(lexer.get_context("foo.bar.baz"),
[ "foo", "bar", "baz" ])
epatters
* Fixed bug in CompletionLexer where a context would be generated for, e.g, 'foo('....
r2640
# Test trailing period.
epatters
Adding unit tests for Qt console frontend.
r2605 self.assertEquals(lexer.get_context("foo.bar."), [ "foo", "bar", "" ])
epatters
* Fixed bug in CompletionLexer where a context would be generated for, e.g, 'foo('....
r2640 # Test with prompt present.
epatters
Adding unit tests for Qt console frontend.
r2605 self.assertEquals(lexer.get_context(">>> foo.bar.baz"),
[ "foo", "bar", "baz" ])
epatters
* Fixed bug in CompletionLexer where a context would be generated for, e.g, 'foo('....
r2640
# Test spacing in name.
epatters
Adding unit tests for Qt console frontend.
r2605 self.assertEquals(lexer.get_context("foo.bar. baz"), [ "baz" ])
epatters
* Fixed bug in CompletionLexer where a context would be generated for, e.g, 'foo('....
r2640 # Test parenthesis.
self.assertEquals(lexer.get_context("foo("), [])
epatters
Adding unit tests for Qt console frontend.
r2605 def testC(self):
""" Does the CompletionLexer work for C/C++?
"""
lexer = CompletionLexer(CLexer())
self.assertEquals(lexer.get_context("foo.bar"), [ "foo", "bar" ])
self.assertEquals(lexer.get_context("foo->bar"), [ "foo", "bar" ])
lexer = CompletionLexer(CppLexer())
self.assertEquals(lexer.get_context("Foo::Bar"), [ "Foo", "Bar" ])
if __name__ == '__main__':
unittest.main()