Exemple #1
0
class ConsoleOutputTest(TestCase):
    '''Tests console output'''

    def setUp(self):
        '''
        Set up display
        '''
        self.display = ConsoleDisplay()

    def tearDown(self):
        '''Restore'''
        pass

    def test_len_color(self):
        '''Test len computation with color'''
        self.display._color = True
        test_str = "Test"
        test_str_colored = self.display.string_color(test_str, 'GREEN')
        self.assertEqual(len(test_str_colored) - self.display.escape,
                         len(test_str))
        self.assertNotEqual(len(test_str_colored), len(test_str),
                            "String must be longer when colored")

    def test_len_without_color(self):
        '''Test len computation without color'''
        self.display._color = False
        test_str = "Test"
        test_str_colored = self.display.string_color(test_str, 'GREEN')
        self.assertEqual(len(test_str_colored), len(test_str))
Exemple #2
0
 def setUp(self):
     '''
     Set up display
     '''
     self.display = ConsoleDisplay()