def initialize(self): """ Does initialization at the beginning of executing table code. """ table = api_util.readObjectFromFile(self._table_filepath, verify=False) self.setTable(table) self.controller.setTable(self._table)
def testRunningSheetWithExport(self): if IGNORE_TEST: return """ Imports two sheets. The first is the Michaelis-Menten sheet. The second is a sheet with S, V, V_MAX, K_M. This test: 1. Exports the first sheet 2. Changes the V_MAX formula in the second sheet to use the export 3. Evaluates the second sheet """ def isEqualColumns(table1, table2, colnm): """ Checks that the tables have the same value for the column name :param Table table1: :param Table table2: :param str colnm: """ value1 = table1.columnFromName(colnm).getCells()[0] value2 = table2.columnFromName(colnm).getCells()[0] self.assertEqual(value1, value2) function_name = "MM" # Read the tables table1 = api_util.readObjectFromFile(join(TEST_DIR, FILE1)) table2 = api_util.readObjectFromFile(join(TEST_DIR, FILE1)) # Set V_MAX in the second table to a dummy value column_v_max_second = table2.columnFromName("V_MAX") column_v_max_second.setFormula("range(10)") evaluator = TableEvaluator(table2) evaluator.evaluate(user_directory=TEST_DIR) # Use the exported first table for the values of V_MAX, K_M table1.export(function_name=function_name, inputs=["S", "V"], outputs=["V_MAX", "K_M"], user_directory=TEST_DIR) formula = "V_MAX, K_M = %s(S, V)" % function_name column_v_max_second.setFormula(formula) evaluator = TableEvaluator(table2) evaluator.evaluate(user_directory=TEST_DIR) isEqualColumns(table1, table2, "V_MAX") isEqualColumns(table1, table2, "K_M")
def testRunningSheetWithExport(self): #if IGNORE_TEST: # return """ Imports two sheets. The first is the Michaelis-Menten sheet. The second is a sheet with S, V, V_MAX, K_M. This test: 1. Exports the first sheet 2. Changes the V_MAX formula in the second sheet to use the export 3. Evaluates the second sheet """ def isEqualColumns(table1, table2, colnm): """ Checks that the tables have the same value for the column name :param Table table1: :param Table table2: :param str colnm: """ value1 = table1.columnFromName(colnm).getCells()[0] value2 = table2.columnFromName(colnm).getCells()[0] self.assertEqual(value1, value2) function_name = "MM" # Read the tables table1 = api_util.readObjectFromFile(join(TEST_DIR, FILE1)) table2 = api_util.readObjectFromFile(join(TEST_DIR, FILE1)) # Set V_MAX in the second table to a dummy value column_v_max_second = table2.columnFromName("V_MAX") column_v_max_second.setFormula("range(10)") evaluator = TableEvaluator(table2) evaluator.evaluate(user_directory=TEST_DIR) # Use the exported first table for the values of V_MAX, K_M table1.export(function_name=function_name, inputs=["S", "V"], outputs=["V_MAX", "K_M"], user_directory=TEST_DIR) formula = "V_MAX, K_M = %s(S, V)" % function_name column_v_max_second.setFormula(formula) evaluator = TableEvaluator(table2) evaluator.evaluate(user_directory=TEST_DIR) isEqualColumns(table1, table2, "V_MAX") isEqualColumns(table1, table2, "K_M")
def readTableFromFile(file_path): return api_util.readObjectFromFile(file_path)