コード例 #1
0
 def testAddEscapesToQuotes(self):
     if IGNORE_TEST:
         return
     list_of_str = ["xy", "x'y'"]
     mod_list_of_str = UITable._addEscapesToQuotes(list_of_str)
     self.assertEqual(mod_list_of_str[1].index("\\"), 1)
     list_of_str = range(3)
     mod_list_of_str = UITable._addEscapesToQuotes(list_of_str)
     self.assertTrue(list_of_str == mod_list_of_str)
コード例 #2
0
 def testCellUpdate(self):
     if IGNORE_TEST:
         return
     table = UITable.createRandomTable(TABLE_NAME, NROW, NCOL)
     before_table = table.copy()
     column_index = 3
     column = table.getChildAtPosition(column_index)
     column_name = column.getName(is_global_name=False)
     ROW_INDEX = 2
     NEW_VALUE = 9999
     cmd_dict = CommandDict.createCommandDict({
         'target': 'Cell',
         'command': 'Update',
         'table_name': None,
         'column_name': column_name,
         'row_index': ROW_INDEX,
         'value': NEW_VALUE
     })
     table.processCommand(cmd_dict)
     self.assertEqual(int(table.getCell(ROW_INDEX, column_name)), NEW_VALUE)
     for c in range(table.numColumns()):
         self.assertEqual(before_table.getColumns()[c].getName(),
                          table.getColumns()[c].getName())
         for r in range(table.numRows()):
             if not (r == ROW_INDEX and c == column_index):
                 self.assertEqual(before_table.getCell(r, c),
                                  table.getCell(r, c))
コード例 #3
0
 def setUp(self):
     if IGNORE_TEST:
         return
     self.table = UITable.createRandomHierarchicalTable(TABLE_NAME,
                                                        NROW,
                                                        NCOL,
                                                        0.3,
                                                        prob_detach=0.2)
コード例 #4
0
 def testRename(self):
     if IGNORE_TEST:
         return
     self.table = UITable.createRandomHierarchicalTable(TABLE_NAME,
                                                        NROW,
                                                        NCOL,
                                                        0.3,
                                                        prob_detach=0.2)
     self._testRename("Table")
     self._testRename("Column")
コード例 #5
0
 def testAppendAndInsert(self):
     if IGNORE_TEST:
         return
     targets = ["Column", "Table"]
     commands = ["Append", "Insert"]
     for target in targets:
         for command in commands:
             self.table = UITable.createRandomHierarchicalTable(
                 TABLE_NAME, NROW, NCOL, 0.3, prob_detach=0.2)
             self._testAppendAndInsert(target, command)
コード例 #6
0
 def testTablize(self):
     #if IGNORE_TEST:
     #  return
     self.table = UITable.createRandomHierarchicalTable(TABLE_NAME,
                                                        NROW,
                                                        NCOL,
                                                        0.3,
                                                        prob_detach=0.2)
     for _ in range(1):
         self._testTablize("Table")
         self._testTablize("Column")
コード例 #7
0
 def testFormula(self):
     if IGNORE_TEST:
         return
     self.table = UITable.createRandomHierarchicalTable(TABLE_NAME,
                                                        NROW,
                                                        NCOL,
                                                        0.3,
                                                        prob_detach=0.2)
     leaves = self.table.getDataColumns(is_recursive=True,
                                        is_attached=False)
     [self._testFormula(c) for c in leaves]
コード例 #8
0
 def setUp(self):
     self.table = UITable.createRandomHierarchicalTable(TABLE_NAME,
                                                        2,
                                                        10,
                                                        0.3,
                                                        prob_detach=0.2)
     self.mock_dict = {}
     self.cmd_dict = CommandDict.createCommandDict({
         'target': "Sheet",
         'command': None,
         'table_name': None,
         'column_name': None,
         'column_index': -1,
         'row_index': None,
         'args': [],
         'value': None,
     })
コード例 #9
0
 def setUp(self):
     self.table = UITable.createRandomHierarchicalTable(TABLE_NAME,
                                                        4,
                                                        10,
                                                        0.3,
                                                        prob_detach=0.2)
     self.row_index = 1
     self.num_rows = self.table.numRows()
     self.cmd_dict = CommandDict.createCommandDict({
         'target': 'Row',
         'command': None,
         'table_name': None,
         'column_name': NAME_COLUMN_STR,
         'column_index': None,
         'args': [self.row_index],
         'row_index': self.row_index,
         'value': None,
     })
     self.row_index_values = self.table.getRow(row_index=self.row_index)
コード例 #10
0
 def createNestedTable(self):
     """
 Table
   A
   B
   Subtable
     C
     D
 :return dict: name, object pairs
 """
     if IGNORE_TEST:
         return
     table = UITable("Table")
     result = {"Table": table}
     result["A"] = Column("A")
     table.addColumn(result["A"])
     result["B"] = Column("B")
     table.addColumn(result["B"])
     subtable = UITable("Subtable")
     result["Subtable"] = subtable
     table.addChild(subtable)
     result["C"] = Column("C")
     subtable.addColumn(result["C"])
     result["D"] = Column("D")
     subtable.addColumn(result["D"])
     return result