Exemplo n.º 1
0
    def test_should_accept_x(self):

        column = Column(50, 'title', 10)

        self.assertEqual(50, column.width)
        self.assertEqual('title', column.title)
        self.assertEqual(10, column.x)
Exemplo n.º 2
0
    def test_should_not_require_x(self):

        column = Column(50, 'title')

        self.assertEqual(50, column.width)
        self.assertEqual('title', column.title)
        self.assertEqual(None, column.x)
Exemplo n.º 3
0
    def get_header(self, height=15):

        columns = [
            Column(45, 'lorem'),
            Column(25, 'ipsum dolor sit amet'),
            Column(30, 'consectetur adipisicing elit'),
            Column(25, 'incididunt ut labore'),
            Column(30, 'et dolore magna aliqua ut'),
            Column(25, 'enim ad minim veniam')
        ]

        return Header(height, columns)
Exemplo n.º 4
0
 def test_should_require_positive_height(self):
     with self.assertRaises(AssertionError):
         Header(0, Column(10, 'hello'))
Exemplo n.º 5
0
 def test_should_reject_non_number_x(self):
     with self.assertRaises(AssertionError):
         Column(50, 'title', '10')
Exemplo n.º 6
0
 def test_should_require_title_text(self):
     with self.assertRaises(AssertionError):
         Column(50, 123)
Exemplo n.º 7
0
 def test_should_require_positive_width(self):
     with self.assertRaises(AssertionError):
         Column(0, 'title')
Exemplo n.º 8
0
 def test_should_get_width_of_n_first_columns(self):
     columns = Column(10, 'lorem'), Column(20, 'ipsum'), Column(15, 'dolor')
     header = Header(10, columns)
     self.assertEqual(30, header.get_width(2))
Exemplo n.º 9
0
 def test_should_get_total_width(self):
     columns = Column(10, 'lorem'), Column(20, 'ipsum'), Column(15, 'dolor')
     header = Header(10, columns)
     self.assertEqual(45, header.get_width())