##// END OF EJS Templates
* Refactored KernelManager to use Traitlets and to have its channels as attributes...
* Refactored KernelManager to use Traitlets and to have its channels as attributes * QtSubChannel and QtXReqChannel work now * Progress on refactoring FrontendWidget to use KernelManager.

File last commit:

r2605:a7fb5f00
r2611:710f79b2
Show More
test_completion_lexer.py
38 lines | 1.2 KiB | text/x-python | PythonLexer
/ IPython / frontend / qt / console / tests / test_completion_lexer.py
# 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())
self.assertEquals(lexer.get_context("foo.bar.baz"),
[ "foo", "bar", "baz" ])
self.assertEquals(lexer.get_context("foo.bar."), [ "foo", "bar", "" ])
self.assertEquals(lexer.get_context(">>> foo.bar.baz"),
[ "foo", "bar", "baz" ])
self.assertEquals(lexer.get_context("foo.bar. baz"), [ "baz" ])
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()