def test_get_strrow_normal_with_escape(self, row_num, expected): df = DataFrame( {r"Design #": [1, 2, 3], r"ratio, %": [4, 5, 6], r"x&y": [10, 11, 12]} ) row_string_converter = RowStringConverter( formatter=DataFrameFormatter(df, escape=True), ) assert row_string_converter.get_strrow(row_num=row_num) == expected
def test_get_strrow_multindex_multicolumn(self, row_num, expected): df = DataFrame( { ("c1", 0): {x: x for x in range(5)}, ("c1", 1): {x: x + 5 for x in range(5)}, ("c2", 0): {x: x for x in range(5)}, ("c2", 1): {x: x + 5 for x in range(5)}, ("c3", 0): {x: x for x in range(5)}, } ) row_string_converter = RowStringConverter( formatter=DataFrameFormatter(df), multicolumn=True, multicolumn_format="r", multirow=True, ) assert row_string_converter.get_strrow(row_num=row_num) == expected