Esempio n. 1
0
 def testCreateVariableForSubtable(self):
   colnm = "SubtableColumn"
   subtable = ht.createTable("Subtable", column_name=colnm)
   self.table.addChild(subtable)
   column = subtable.childFromName(colnm)
   cv = ColumnVariable(column)
   self.assertEqual(cv.getColumnValue(), column.getCells())
 def setUp(self):
   self.table = ht.createTable("TEST",
       column_name=[ht.COLUMN1, ht.COLUMN2])
   new_column = Column(FORMULA_COLUMN_NAME)
   new_column.setFormula("np.sin(%s)" % ht.COLUMN1)
   self.table.addColumn(new_column)
   self.table.evaluate()
   columns = self.table.getColumns()
   self.column_variables =  \
       [ColumnVariable(c) for c in columns] 
Esempio n. 3
0
 def setUp(self):
   self.table = ht.createTable("TEST",
       column_name=[ht.COLUMN1, ht.COLUMN2])
   new_column = Column(FORMULA_COLUMN_NAME)
   new_column.setFormula("np.sin(%s)" % ht.COLUMN1)
   self.table.addColumn(new_column)
   self.table.evaluate()
   columns = self.table.getColumns()
   self.column_variables =  \
       [ColumnVariable(c) for c in columns] 
 def setUp(self):
   self.table = createTable(TABLE_NAME)
   self._addColumn(COLUMN1, cells=COLUMN1_CELLS)
   self.column_a = self._addColumn(COLUMN2, cells=COLUMN2_CELLS)
   self.column_b = self._addColumn(COLUMN5, cells=COLUMN5_CELLS)
   self.column_c = self._addColumn(COLUMNC, cells=COLUMNC_CELLS)
   self.column_valid_formula = self._addColumn(COLUMN_VALID_FORMULA,
                                               formula=VALID_FORMULA)
   writeObjectToFile(self.table)
   self.generator = pg.ProgramGenerator(self.table, TEST_DIR)
 def setUp(self):
     self.table = createTable(TABLE_NAME)
     self._addColumn(COLUMN1, cells=COLUMN1_CELLS)
     self.column_a = self._addColumn(COLUMN2, cells=COLUMN2_CELLS)
     self.column_b = self._addColumn(COLUMN5, cells=COLUMN5_CELLS)
     self.column_c = self._addColumn(COLUMNC, cells=COLUMNC_CELLS)
     self.column_valid_formula = self._addColumn(COLUMN_VALID_FORMULA,
                                                 formula=VALID_FORMULA)
     writeObjectToFile(self.table)
     self.generator = pg.ProgramGenerator(self.table, TEST_DIR)
Esempio n. 6
0
 def testCopyTableToFile(self):
     filename = ht.TEST_FILENAME[:-4]  # Exclude ".pcl"
     table = ht.createTable("test_table")
     new_filepath = api_util.copyTableToFile(table, filename, ht.TEST_DIR)
     path = os.path.join(ht.TEST_DIR, ht.TEST_FILENAME)
     self.assertEqual(stripFileExtension(new_filepath),
                      stripFileExtension(path))
     self.assertTrue(os.path.exists(new_filepath))
     new_table = api_util.readObjectFromFile(new_filepath, verify=False)
     self.assertTrue(table.isEquivalent(new_table))
     os.remove(new_filepath)
 def testMakePrologueWithoutFormulas(self):
   # Table without formulas
   self.table = createTable(TABLE_NAME)
   self._addColumn(COLUMN1, cells=COLUMN1_CELLS)
   self.column_a = self._addColumn(COLUMN2, cells=COLUMN2_CELLS)
   self.column_b = self._addColumn(COLUMN5, cells=COLUMN5_CELLS)
   self.column_c = self._addColumn(COLUMNC, cells=COLUMNC_CELLS)
   writeObjectToFile(self.table)
   self.generator = pg.ProgramGenerator(self.table, TEST_DIR)
   # Test Prologue and Epilogue
   statements = self.generator._makePrologue()
   self.assertTrue('import' in statements)
   self.assertIsNone(_compile(statements))
   statements = self.generator._makeEpilogue()
   self.assertTrue('s.controller.startBlock' in statements)
   self.assertIsNone(_compile(statements))
 def testMakePrologueWithoutFormulas(self):
     # Table without formulas
     self.table = createTable(TABLE_NAME)
     self._addColumn(COLUMN1, cells=COLUMN1_CELLS)
     self.column_a = self._addColumn(COLUMN2, cells=COLUMN2_CELLS)
     self.column_b = self._addColumn(COLUMN5, cells=COLUMN5_CELLS)
     self.column_c = self._addColumn(COLUMNC, cells=COLUMNC_CELLS)
     writeObjectToFile(self.table)
     self.generator = pg.ProgramGenerator(self.table, TEST_DIR)
     # Test Prologue and Epilogue
     statements = self.generator._makePrologue()
     self.assertTrue('import' in statements)
     self.assertIsNone(_compile(statements))
     statements = self.generator._makeEpilogue()
     self.assertTrue('s.controller.startBlock' in statements)
     self.assertIsNone(_compile(statements))