##// END OF EJS Templates
Backport PR #2773: Fixed minor typo causing AttributeError to be thrown....
Backport PR #2773: Fixed minor typo causing AttributeError to be thrown. I'm not sure how I caused the error to be thrown and couldn't reproduce it with the same call again, nevertheless I think the fix is correct. ```python In [21]: rc.shutdown(hub=True) Traceback (most recent call last): File "<ipython-input-21-977a05a15f31>", line 1, in <module> rc.shutdown(hub=True) File "<string>", line 2, in shutdown File "c:\dev\code\ipython\IPython\parallel\client\client.py", line 69, in spin_first self.spin() File "c:\dev\code\ipython\IPython\parallel\client\client.py", line 1005, in spin self._flush_notifications() File "c:\dev\code\ipython\IPython\parallel\client\client.py", line 800, in _flush_notifications raise Exception("Unhandled message type: %s"%msg.msg_type) AttributeError: 'dict' object has no attribute 'msg_type' ```

File last commit:

r6574:e3e71346
r9855:7ad908bf
Show More
test_console_widget.py
42 lines | 1.3 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.instance()
if cls._app is None:
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('')