Show More
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
@@ -0,0 +1,38 b'' | |||||
|
1 | # Standard library imports | |||
|
2 | import unittest | |||
|
3 | ||||
|
4 | # System library imports | |||
|
5 | from pygments.lexers import CLexer, CppLexer, PythonLexer | |||
|
6 | ||||
|
7 | # Local imports | |||
|
8 | from IPython.frontend.qt.console.completion_lexer import CompletionLexer | |||
|
9 | ||||
|
10 | ||||
|
11 | class TestCompletionLexer(unittest.TestCase): | |||
|
12 | ||||
|
13 | def testPython(self): | |||
|
14 | """ Does the CompletionLexer work for Python? | |||
|
15 | """ | |||
|
16 | lexer = CompletionLexer(PythonLexer()) | |||
|
17 | ||||
|
18 | self.assertEquals(lexer.get_context("foo.bar.baz"), | |||
|
19 | [ "foo", "bar", "baz" ]) | |||
|
20 | self.assertEquals(lexer.get_context("foo.bar."), [ "foo", "bar", "" ]) | |||
|
21 | ||||
|
22 | self.assertEquals(lexer.get_context(">>> foo.bar.baz"), | |||
|
23 | [ "foo", "bar", "baz" ]) | |||
|
24 | self.assertEquals(lexer.get_context("foo.bar. baz"), [ "baz" ]) | |||
|
25 | ||||
|
26 | def testC(self): | |||
|
27 | """ Does the CompletionLexer work for C/C++? | |||
|
28 | """ | |||
|
29 | lexer = CompletionLexer(CLexer()) | |||
|
30 | self.assertEquals(lexer.get_context("foo.bar"), [ "foo", "bar" ]) | |||
|
31 | self.assertEquals(lexer.get_context("foo->bar"), [ "foo", "bar" ]) | |||
|
32 | ||||
|
33 | lexer = CompletionLexer(CppLexer()) | |||
|
34 | self.assertEquals(lexer.get_context("Foo::Bar"), [ "Foo", "Bar" ]) | |||
|
35 | ||||
|
36 | ||||
|
37 | if __name__ == '__main__': | |||
|
38 | unittest.main() |
General Comments 0
You need to be logged in to leave comments.
Login now