def test_divide_eval(self): div_compiler = model.ModelCompiler() div_model = div_compiler.read_and_parse_archive( testing.get_resource("division.xlsx")) div_evaluator = evaluator.Evaluator(div_model) excel_value_00 = div_evaluator.get_cell_value('Sheet1!A1') value_00 = div_evaluator.evaluate('Sheet1!A1') self.assertEqual(excel_value_00, value_00) excel_value_01 = div_evaluator.get_cell_value('Sheet1!B1') value_01 = div_evaluator.evaluate('Sheet1!B1') self.assertEqual(excel_value_01, value_01)
def test_addition_eval(self): add_compiler = model.ModelCompiler() add_model = add_compiler.read_and_parse_archive( testing.get_resource("addition.xlsx")) add_evaluator = evaluator.Evaluator(add_model) excel_value_00 = add_evaluator.get_cell_value('Sheet1!A1') value_00 = add_evaluator.evaluate('Sheet1!A1') self.assertEqual(excel_value_00, value_00) excel_value_01 = add_evaluator.get_cell_value('Sheet1!B1') value_01 = add_evaluator.evaluate('Sheet1!B1') self.assertEqual(excel_value_01, value_01) excel_value_02 = add_evaluator.get_cell_value('Sheet1!C1') value_02 = add_evaluator.evaluate('Sheet1!C1') self.assertEqual(excel_value_02, value_02)
def test_subtract_eval(self): sub_compiler = model.ModelCompiler() sub_model = sub_compiler.read_and_parse_archive( testing.get_resource("subtraction.xlsx")) sub_evaluator = evaluator.Evaluator(sub_model) excel_value_00 = sub_evaluator.get_cell_value('Sheet1!A1') value_00 = sub_evaluator.evaluate('Sheet1!A1') self.assertEqual(excel_value_00, value_00) excel_value_01 = sub_evaluator.get_cell_value('Sheet1!B1') value_01 = sub_evaluator.evaluate('Sheet1!B1') self.assertEqual(excel_value_01, value_01) excel_value_02 = sub_evaluator.get_cell_value('Sheet1!C1') value_02 = sub_evaluator.evaluate('Sheet1!C1') self.assertEqual(excel_value_02, value_02)
def setUp(self): compiler = model.ModelCompiler() self.model = compiler.read_and_parse_archive( get_resource(self.filename)) self.evaluator = evaluator.Evaluator(self.model)
def setUp(self): self.model = model.Model() self.model.construct_from_json_file(testing.get_resource("model.json"), build_code=True) self.evaluator = evaluator.Evaluator(self.model)