def testBreakingCases(self): """ Testing some cases observed to fail previously """ tab1, tab2, tab3 = None, None, None with self.subTest(msg="charCol with list"): tab1 = TableTools.newTable( TableTools.charCol('tab1', ['A', 'B', 'C', 'D'])) print("tab1 = \n{}".format(TableTools.html(tab1))) with self.subTest(msg="charCol with string"): tab2 = TableTools.newTable(TableTools.charCol('tab2', 'EFGH')) print("tab2 = \n{}".format(TableTools.html(tab2))) with self.subTest(msg="col with single string"): tab3 = TableTools.newTable(TableTools.col('tab3', 'EFGH')) print("tab3 = \n{}".format(TableTools.html(tab3))) del tab1, tab2, tab3
def testColumnHolder(self): """ Test cases for <primitive>Col() methods & associated newTable() method """ holders = [] junk, tab = None, None with self.subTest(msg="byteCol"): holders.append(TableTools.byteCol("byteCol", self.nByteArray)) with self.subTest(msg="shortCol"): holders.append(TableTools.shortCol("shortCol", self.nShortArray)) with self.subTest(msg="intCol"): holders.append(TableTools.intCol("intCol", self.nIntArray)) with self.subTest(msg="longCol"): holders.append(TableTools.longCol("longCol", self.nLongArray)) with self.subTest(msg="floatCol"): holders.append(TableTools.floatCol("floatCol", self.floatList)) with self.subTest(msg="doubleCol"): holders.append(TableTools.doubleCol("doubleCol", self.nDoubleArray)) with self.subTest(msg="charCol"): holders.append(TableTools.charCol("charCol", self.nCharArray)) with self.subTest(msg="newTable with column holders"): self.assertGreater(len(holders), 0) # make sure that we even do something useful tab = TableTools.newTable(*holders) print("tab =\n{}".format(TableTools.html(tab))) del holders, tab holders = [] with self.subTest(msg="byteCol with list"): holders.append(TableTools.byteCol("byteList", self.intList)) with self.subTest(msg="shortCol with list"): holders.append(TableTools.shortCol("shortList", self.intList)) with self.subTest(msg="intCol with list"): holders.append(TableTools.intCol("intList", self.intList)) with self.subTest(msg="longCol with list"): holders.append(TableTools.longCol("longList", self.intList)) with self.subTest(msg="floatCol with list"): holders.append(TableTools.doubleCol("floatList", self.floatList)) with self.subTest(msg="doubleCol with list"): holders.append(TableTools.doubleCol("doubleList", self.floatList)) with self.subTest(msg="charCol with list"): holders.append(TableTools.charCol("charList", self.charList)) print('prim col from list = \n{}'.format( TableTools.html(TableTools.newTable(*holders)))) del holders holders = [] with self.subTest(msg="col with string array"): holders.append(TableTools.col("stringCol", self.nStringArray)) with self.subTest(msg="col with boolean array"): holders.append(TableTools.col("booleanCol", self.nBooleanArray)) with self.subTest(msg="col with time array"): holders.append(TableTools.col("timeCol", self.nTimeArray)) print('obj col = \n{}'.format( TableTools.html(TableTools.newTable(*holders)))) del holders holders = [] with self.subTest(msg="col with int list"): holders.append(TableTools.col("intList2", self.intList)) with self.subTest(msg="col with double list"): holders.append(TableTools.col("doubleList2", self.floatList)) with self.subTest(msg="col with char list"): holders.append(TableTools.col("stringList", self.stringList)) with self.subTest(msg="col with char list"): holders.append(TableTools.col("charList2", self.charList)) with self.subTest(msg="col with boolean list"): holders.append(TableTools.col("booleanList", self.booleanList)) with self.subTest(msg="col with time list"): holders.append(TableTools.col("timeList", self.timeList)) print('col from list = \n{}'.format( TableTools.html(TableTools.newTable(*holders)))) del holders holders = [] with self.subTest(msg="col with byte"): holders.append(TableTools.col("byteCol", self.nByteArray)) with self.subTest(msg="col with short"): holders.append(TableTools.col("shortCol", self.nShortArray)) with self.subTest(msg="col with int"): holders.append(TableTools.col("intCol", self.nIntArray)) with self.subTest(msg="col with long"): holders.append(TableTools.col("longCol", self.nLongArray)) with self.subTest(msg="col with float"): holders.append(TableTools.col("floatCol", self.nFloatArray)) with self.subTest(msg="col with double"): holders.append(TableTools.col("doubleCol", self.nDoubleArray)) with self.subTest(msg="col with char"): holders.append(TableTools.col("charCol", self.nCharArray)) print("primitive from col =\n{}".format( TableTools.html(TableTools.newTable(*holders)))) del holders