Esempio n. 1
0
    def test_customlabel(self):
        """Limited test of custom custom labeling"""
        if has_numpy:
            tbl = SimpleTable(table1data, test1header, test1stubs, txt_fmt=txt_fmt1)
            tbl[1][1].data = np.nan
            tbl.label_cells(custom_labeller)
            # print([[c.datatype for c in row] for row in tbl])
            desired = """
*****************************
*       * header1 * header2 *
*****************************
* stub1 *    --   *       1 *
* stub2 *    2.00 *       3 *
*****************************
"""
            actual = "\n%s\n" % tbl.as_text(missing="--")
            # print(actual)
            # print(desired)
            self.assertEqual(actual, desired)
Esempio n. 2
0
    def test_customlabel(self):
        """Limited test of custom custom labeling"""
        if has_numpy:
            tbl = SimpleTable(table1data,
                              test1header,
                              test1stubs,
                              txt_fmt=txt_fmt1)
            tbl[1][1].data = np.nan
            tbl.label_cells(custom_labeller)
            #print([[c.datatype for c in row] for row in tbl])
            desired = """
*****************************
*       * header1 * header2 *
*****************************
* stub1 *    --   *       1 *
* stub2 *    2.00 *       3 *
*****************************
"""
            actual = '\n%s\n' % tbl.as_text(missing='--')
            #print(actual)
            #print(desired)
            self.assertEqual(actual, desired)