##// END OF EJS Templates
TST: Add tests to check the actual output on the console.
Puneeth Chaganti -
Show More
@@ -0,0 +1,40 b''
1 # Standard library imports
2 import unittest
3
4 # System library imports
5 from IPython.external.qt import QtGui
6
7 # Local imports
8 from IPython.frontend.qt.console.console_widget import ConsoleWidget
9
10
11 class TestConsoleWidget(unittest.TestCase):
12
13 @classmethod
14 def setUpClass(cls):
15 """ Create the application for the test case.
16 """
17 cls._app = QtGui.QApplication([])
18 cls._app.setQuitOnLastWindowClosed(False)
19
20 @classmethod
21 def tearDownClass(cls):
22 """ Exit the application.
23 """
24 QtGui.QApplication.quit()
25
26 def test_special_characters(self):
27 """ Are special characters displayed correctly?
28 """
29 w = ConsoleWidget()
30 cursor = w._get_prompt_cursor()
31
32 test_inputs = ['xyz\b\b=\n', 'foo\b\nbar\n', 'foo\b\nbar\r\n', 'abc\rxyz\b\b=']
33 expected_outputs = [u'x=z\u2029', u'foo\u2029bar\u2029', u'foo\u2029bar\u2029', 'x=z']
34 for i, text in enumerate(test_inputs):
35 w._insert_plain_text(cursor, text)
36 cursor.select(cursor.Document)
37 selection = cursor.selectedText()
38 self.assertEquals(expected_outputs[i], selection)
39 # clear all the text
40 cursor.insertText('')
General Comments 0
You need to be logged in to leave comments. Login now