Beispiel #1
0
    def test_it_should_allow_the_message_to_be_blank(self):
        test_bar1 = r'======================================================================'
        test_bar2 = r'//==================================================================\\'
        test_bar3 = r'\\==================================================================//'

        self.assertEqual(bar(width=70), test_bar1)
        self.assertEqual(bar(width=70, position='top'), test_bar2)
        self.assertEqual(bar(width=70, position='bottom'), test_bar3)
Beispiel #2
0
    def test_it_should_allow_the_message_to_be_blank(self):
        test_bar1 = r'======================================================================'
        test_bar2 = r'//==================================================================\\'
        test_bar3 = r'\\==================================================================//'

        self.assertEqual(bar(width=70), test_bar1)
        self.assertEqual(bar(width=70, position='top'), test_bar2)
        self.assertEqual(bar(width=70, position='bottom'), test_bar3)
Beispiel #3
0
    def test_it_should_render_a_top_bottom_or_plain_bar_depending_on_the_position_argument(self):
        test_bar1 = r'================================ test ================================'
        test_bar2 = r'//============================== test ==============================\\'
        test_bar3 = r'\\============================== test ==============================//'

        self.assertEqual(bar('test', width=70), test_bar1)
        self.assertEqual(bar('test', width=70, position='top'), test_bar2)
        self.assertEqual(bar('test', width=70, position='bottom'), test_bar3)
Beispiel #4
0
    def test_it_should_render_a_top_bottom_or_plain_bar_depending_on_the_position_argument(
            self):
        test_bar1 = r'================================ test ================================'
        test_bar2 = r'//============================== test ==============================\\'
        test_bar3 = r'\\============================== test ==============================//'

        self.assertEqual(bar('test', width=70), test_bar1)
        self.assertEqual(bar('test', width=70, position='top'), test_bar2)
        self.assertEqual(bar('test', width=70, position='bottom'), test_bar3)
Beispiel #5
0
    def test_it_should_return_a_bar_string_with_the_specified_width(self):
        test_bar1 = r'=========================== test ==========================='
        test_bar2 = r'//========================= test =========================\\'
        test_bar3 = r'\\========================= test =========================//'

        self.assertEqual(len(test_bar1), 60)
        self.assertEqual(len(test_bar2), 60)
        self.assertEqual(len(test_bar3), 60)

        self.assertEqual(bar('test', width=60), test_bar1)
        self.assertEqual(bar('test', width=60, position='top'), test_bar2)
        self.assertEqual(bar('test', width=60, position='bottom'), test_bar3)
Beispiel #6
0
    def test_it_should_return_a_bar_string_with_the_specified_width(self):
        test_bar1 = r'=========================== test ==========================='
        test_bar2 = r'//========================= test =========================\\'
        test_bar3 = r'\\========================= test =========================//'

        self.assertEqual(len(test_bar1), 60)
        self.assertEqual(len(test_bar2), 60)
        self.assertEqual(len(test_bar3), 60)

        self.assertEqual(bar('test', width=60), test_bar1)
        self.assertEqual(bar('test', width=60, position='top'), test_bar2)
        self.assertEqual(bar('test', width=60, position='bottom'), test_bar3)
Beispiel #7
0
 def test_it_should_return_a_string_with_text_centered_in_a_bar(self):
     self.assertEqual(
         bar('test', width=70),
         '================================ test ================================',
     )
Beispiel #8
0
 def test_it_should_work_even_if_the_given_width_is_less_than_the_message_length(
         self):
     self.assertEqual(bar('test', width=0), '== test ==')
     self.assertEqual(bar('test', width=0, position='top'), r'// test \\')
     self.assertEqual(bar('test', width=0, position='bottom'),
                      r'\\ test //')
Beispiel #9
0
 def test_it_should_return_a_string_with_text_centered_in_a_bar(self):
     self.assertEqual(
         bar('test', width=70),
         '================================ test ================================',
     )
Beispiel #10
0
 def test_it_should_work_even_if_the_given_width_is_less_than_the_message_length(self):
     self.assertEqual(bar('test', width=0), '== test ==')
     self.assertEqual(bar('test', width=0, position='top'), r'// test \\')
     self.assertEqual(bar('test', width=0, position='bottom'), r'\\ test //')