Пример #1
0
    def test_pys_width2xls_width(self, pys_width):
        """Unit test for pys_width2xls_width and xls_width2pys_width

        Roundtrip test

        """

        wb = xlwt.Workbook()
        xls_out = Xls(self.code_array, wb)
        xls_width = xls_out.pys_width2xls_width(pys_width)
        roundtrip_width = xls_out.xls_width2pys_width(xls_width)

        assert round(pys_width) == round(roundtrip_width)
Пример #2
0
    def test_pys_width2xls_width(self, pys_width):
        """Unit test for pys_width2xls_width and xls_width2pys_width

        Roundtrip test

        """

        wb = xlwt.Workbook()
        xls_out = Xls(self.code_array, wb)
        xls_width = xls_out.pys_width2xls_width(pys_width)
        roundtrip_width = xls_out.xls_width2pys_width(xls_width)

        assert round(pys_width) == round(roundtrip_width)
Пример #3
0
    def test_col_widths2xls(self, col, tab, width):
        """Test _col_widths2xls method"""

        self.code_array.shape = (1000, 100, 30)
        self.code_array.dict_grid.col_widths = {(col, tab): width}

        wb = xlwt.Workbook()
        xls_out = Xls(self.code_array, wb)
        worksheets = []
        xls_out._shape2xls(worksheets)
        self.write_xls_out(xls_out, wb, "_col_widths2xls", worksheets)
        workbook = self.read_xls_out()

        points = xls_out.pys_width2xls_width(width)

        worksheets = workbook.sheets()
        worksheet = worksheets[tab]
        assert worksheet.colinfo_map[col].width == points
Пример #4
0
    def test_col_widths2xls(self, col, tab, width):
        """Test _col_widths2xls method"""

        self.code_array.shape = (1000, 100, 30)
        self.code_array.dict_grid.col_widths = {(col, tab): width}

        wb = xlwt.Workbook()
        xls_out = Xls(self.code_array, wb)
        worksheets = []
        xls_out._shape2xls(worksheets)
        self.write_xls_out(xls_out, wb, "_col_widths2xls", worksheets)
        workbook = self.read_xls_out()

        points = xls_out.pys_width2xls_width(width)

        worksheets = workbook.sheets()
        worksheet = worksheets[tab]
        assert worksheet.colinfo_map[col].width == points