##// END OF EJS Templates
Merge pull request #1597 from minrk/while_eventloop...
Merge pull request #1597 from minrk/while_eventloop re-enter kernel.eventloop after catching SIGINT This protects the kernel from exiting due to bugs failing to catch SIGINT properly in the eventloop integration functions, as described in #1228. It does not fix those bugs, only reduces the severity of their consequences.

File last commit:

r6437:71fcb629
r6481:9d865c8f merge
Show More
test_console_widget.py
40 lines | 1.2 KiB | text/x-python | PythonLexer
# Standard library imports
import unittest
# System library imports
from IPython.external.qt import QtGui
# Local imports
from IPython.frontend.qt.console.console_widget import ConsoleWidget
class TestConsoleWidget(unittest.TestCase):
@classmethod
def setUpClass(cls):
""" Create the application for the test case.
"""
cls._app = QtGui.QApplication([])
cls._app.setQuitOnLastWindowClosed(False)
@classmethod
def tearDownClass(cls):
""" Exit the application.
"""
QtGui.QApplication.quit()
def test_special_characters(self):
""" Are special characters displayed correctly?
"""
w = ConsoleWidget()
cursor = w._get_prompt_cursor()
test_inputs = ['xyz\b\b=\n', 'foo\b\nbar\n', 'foo\b\nbar\r\n', 'abc\rxyz\b\b=']
expected_outputs = [u'x=z\u2029', u'foo\u2029bar\u2029', u'foo\u2029bar\u2029', 'x=z']
for i, text in enumerate(test_inputs):
w._insert_plain_text(cursor, text)
cursor.select(cursor.Document)
selection = cursor.selectedText()
self.assertEquals(expected_outputs[i], selection)
# clear all the text
cursor.insertText('')