Exemplo n.º 1
0
    def test_print_bars_width_overlap(self):
        table = Table(self.rows, self.column_names, self.column_types)

        output = six.StringIO()
        table.print_bars('three', 'one', width=20, output=output)
        lines = output.getvalue().split('\n')

        self.assertEqual(max([len(l) for l in lines]), 20)
Exemplo n.º 2
0
    def test_print_bars_width_overlap(self):
        table = Table(self.rows, self.columns)

        output = six.StringIO()
        table.print_bars('three', 'one', width=20, output=output)
        lines = output.getvalue().split('\n')

        self.assertEqual(max([len(l) for l in lines]), 20)
Exemplo n.º 3
0
    def test_print_bars_mixed_signs(self):
        rows = (
            ('-1.7', 2, 'a'),
            ('11.18', None, None),
            ('0', 1, 'c')
        )

        table = Table(rows, self.columns)
        table.print_bars('three', 'one')
Exemplo n.º 4
0
    def test_print_bars_mixed_signs(self):
        rows = (
            ('-1.7', 2, 'a'),
            ('11.18', None, None),
            ('0', 1, 'c')
        )

        table = Table(rows, self.column_names, self.column_types)
        table.print_bars('three', 'one')
Exemplo n.º 5
0
    def test_print_bars_negative(self):
        rows = (
            ('-1.7', 2, 'a'),
            ('-11.18', None, None),
            ('0', 1, 'c')
        )

        table = Table(rows, self.columns)
        table.print_bars('three', 'one')
Exemplo n.º 6
0
    def test_print_bars_with_nulls(self):
        table = Table(self.rows, self.column_names, self.column_types)

        output = six.StringIO()
        table.print_bars('three', 'two', width=20, printable=True,
                         output=output)

        self.assertEqual(output.getvalue(), "three   two\n"
                                            "a     2,000 |:::::::\n"
                                            "None      - |       \n"
                                            "c         1 |       \n"
                                            "            +------+\n"
                                            "            0  2,000\n")
Exemplo n.º 7
0
    def test_print_bars_with_nulls(self):
        table = Table(self.rows, self.column_names, self.column_types)

        output = six.StringIO()
        table.print_bars('three',
                         'two',
                         width=20,
                         printable=True,
                         output=output)

        self.assertEqual(
            output.getvalue(), "three   two\n"
            "a     " + format_decimal(2000, format=u'#,##0') + " |:::::::\n"
            "None      - |       \n"
            "c         1 |       \n"
            "            +------+\n"
            "            0  " + format_decimal(2000, format=u'#,##0') + "\n")
    def test_print_bars_with_nulls(self):
        table = Table(self.rows, self.column_names, self.column_types)

        output = six.StringIO()
        table.print_bars('three',
                         'two',
                         width=20,
                         printable=True,
                         output=output)

        self.assertEqual(
            output.getvalue(), "three   two\n"
            "a     2,000 |:::::::\n"
            "None      - |       \n"
            "c         1 |       \n"
            "            +------+\n"
            "            0  2,000\n")
Exemplo n.º 9
0
    def test_print_bars_invalid_values(self):
        table = Table(self.rows, self.column_names, self.column_types)

        with self.assertRaises(DataTypeError):
            table.print_bars('one', 'three')
Exemplo n.º 10
0
    def test_print_bars_negative(self):
        rows = (('-1.7', 2, 'a'), ('-11.18', None, None), ('0', 1, 'c'))

        table = Table(rows, self.column_names, self.column_types)
        table.print_bars('three', 'one')
Exemplo n.º 11
0
    def test_print_bars_domain_invalid(self):
        table = Table(self.rows, self.column_names, self.column_types)

        with self.assertRaises(ValueError):
            table.print_bars('three', 'one', domain=(5, 0))
Exemplo n.º 12
0
    def test_print_bars_domain(self):
        table = Table(self.rows, self.column_names, self.column_types)

        table.print_bars('three', 'one', domain=(0, 300))
Exemplo n.º 13
0
    def test_print_bars(self):
        table = Table(self.rows, self.column_names, self.column_types)

        output = six.StringIO()
        table.print_bars('three', 'one', output=output)
        lines = output.getvalue().split('\n')
Exemplo n.º 14
0
    def test_print_bars_invalid_values(self):
        table = Table(self.rows, self.columns)

        with self.assertRaises(DataTypeError):
            table.print_bars('one', 'three')
Exemplo n.º 15
0
    def test_print_bars(self):
        table = Table(self.rows, self.columns)

        output = six.StringIO()
        table.print_bars('three', 'one', output=output)
        lines = output.getvalue().split('\n')
Exemplo n.º 16
0
    def test_print_bars_domain_invalid(self):
        table = Table(self.rows, self.columns)

        with self.assertRaises(ValueError):
            table.print_bars('three', 'one', domain=(5, 0))
Exemplo n.º 17
0
    def test_print_bars_domain(self):
        table = Table(self.rows, self.columns)

        table.print_bars('three', 'one', domain=(0, 300))