def test_normal_format(self, values, expected_list):
        col_dp = ColumnDataProperty(format_flags=Format.THOUSAND_SEPARATOR)

        col_dp.update_header(DataProperty("format test"))
        for value in values:
            col_dp.update_body(DataProperty(value))

        for value, expected in zip(values, expected_list):
            assert col_dp.dp_to_str(DataProperty(value)) == expected
    def test_normal_format(self, values, expected_list):
        col_dp = ColumnDataProperty(format_flags=Format.THOUSAND_SEPARATOR)

        col_dp.update_header(DataProperty("format test"))
        for value in values:
            col_dp.update_body(DataProperty(value))

        for value, expected in zip(values, expected_list):
            assert col_dp.dp_to_str(DataProperty(value)) == expected
    def test_normal_2(self):
        col_dp = ColumnDataProperty()
        values = [1.1, 2.2, 3.33]
        expected_list = ["1.10", "2.20", "3.33"]

        col_dp.update_header(DataProperty("abc"))
        for value in values:
            col_dp.update_body(DataProperty(value))

        for value, expected in zip(values, expected_list):
            assert col_dp.dp_to_str(DataProperty(value)) == expected
    def test_normal_1(self):
        col_dp = ColumnDataProperty()
        values = [0, 0.1]
        expected_list = ["0", "0.1"]

        col_dp.update_header(DataProperty("abc"))
        for value in ["abcd", "efg"]:
            col_dp.update_body(DataProperty(value))

        for value, expected in zip(values, expected_list):
            assert col_dp.dp_to_str(DataProperty(value)) == expected
    def test_normal_2(self):
        col_dp = ColumnDataProperty()
        values = [1.1, 2.2, 3.33]
        expected_list = ["1.10", "2.20", "3.33"]

        col_dp.update_header(DataProperty("abc"))
        for value in values:
            col_dp.update_body(DataProperty(value))

        for value, expected in zip(values, expected_list):
            assert col_dp.dp_to_str(DataProperty(value)) == expected
    def test_normal_1(self):
        col_dp = ColumnDataProperty()
        values = [0, 0.1]
        expected_list = ["0", "0.1"]

        col_dp.update_header(DataProperty("abc"))
        for value in ["abcd", "efg"]:
            col_dp.update_body(DataProperty(value))

        for value, expected in zip(values, expected_list):
            assert col_dp.dp_to_str(DataProperty(value)) == expected
    def test_normal_0(self):
        col_dp = ColumnDataProperty()
        values = [0.1, 3.4375, 65.5397978633, 189.74439359, 10064.0097539, "abcd"]
        expected_list = ["0.100", "3.437", "65.540", "189.744", "10064.010", "abcd"]

        col_dp.update_header(DataProperty("abc"))
        for value in values:
            col_dp.update_body(DataProperty(value))

        for value, expected in zip(values, expected_list):
            assert col_dp.dp_to_str(DataProperty(value)) == expected
    def test_normal_0(self):
        col_dp = ColumnDataProperty()
        values = [
            0.1, 3.4375, 65.5397978633, 189.74439359, 10064.0097539, "abcd"
        ]
        expected_list = [
            "0.100", "3.437", "65.540", "189.744", "10064.010", "abcd"
        ]

        col_dp.update_header(DataProperty("abc"))
        for value in values:
            col_dp.update_body(DataProperty(value))

        for value, expected in zip(values, expected_list):
            assert col_dp.dp_to_str(DataProperty(value)) == expected
Example #9
0
 def _apply_style_to_row_item(self, row_idx: int,
                              col_dp: ColumnDataProperty,
                              value_dp: DataProperty, style: Style) -> str:
     return self._styler.apply_align(self._styler.apply(
         col_dp.dp_to_str(value_dp), style=style),
                                     style=style)