##// END OF EJS Templates
Merge pull request #4498 from takluyver/daemon-streamcapturer...
Merge pull request #4498 from takluyver/daemon-streamcapturer Daemon StreamCapturer The StreamCapturer should die if the main thread crashes. On Shiningpanda, a failure in another nose plugin has been causing the tests to hang, because the main thread exits, but the StreamCapturer thread is still alive. Under normal conditions, the thread will still be shut down cleanly - it will only die a messy death if the main thread does.

File last commit:

r11024:4571a5fb
r13524:b1976c99 merge
Show More
test_completion_lexer.py
47 lines | 1.4 KiB | text/x-python | PythonLexer
/ IPython / 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.qt.console.completion_lexer import CompletionLexer
class TestCompletionLexer(unittest.TestCase):
def testPython(self):
""" Does the CompletionLexer work for Python?
"""
lexer = CompletionLexer(PythonLexer())
# Test simplest case.
self.assertEqual(lexer.get_context("foo.bar.baz"),
[ "foo", "bar", "baz" ])
# Test trailing period.
self.assertEqual(lexer.get_context("foo.bar."), [ "foo", "bar", "" ])
# Test with prompt present.
self.assertEqual(lexer.get_context(">>> foo.bar.baz"),
[ "foo", "bar", "baz" ])
# Test spacing in name.
self.assertEqual(lexer.get_context("foo.bar. baz"), [ "baz" ])
# Test parenthesis.
self.assertEqual(lexer.get_context("foo("), [])
def testC(self):
""" Does the CompletionLexer work for C/C++?
"""
lexer = CompletionLexer(CLexer())
self.assertEqual(lexer.get_context("foo.bar"), [ "foo", "bar" ])
self.assertEqual(lexer.get_context("foo->bar"), [ "foo", "bar" ])
lexer = CompletionLexer(CppLexer())
self.assertEqual(lexer.get_context("Foo::Bar"), [ "Foo", "Bar" ])
if __name__ == '__main__':
unittest.main()