class TestExcelDriverDummy(unittest.TestCase): def setUp(self): self.excel_driver_obj = ExcelDriverDummy() def test_basic_read_write(self): self.excel_driver_obj.set_cell_value("A1", 1.0, "Sheet1") self.excel_driver_obj.set_cell_value("A2", 2.0, "Sheet1") self.excel_driver_obj.set_cell_value("A3", 2.0, "Sheet1") a = self.excel_driver_obj.read_cell_value("A1", "Sheet1") self.assertEquals(1.0, a) b = self.excel_driver_obj.read_cell_value("A2", "Sheet1") self.assertEquals(2.0, b) def test_function_evaluation(self): self.excel_driver_obj.set_cell_value("B1", 1.5, "Sheet1") self.excel_driver_obj.set_cell_value("B2", 2.0, "Sheet1") self.excel_driver_obj.set_cell_value("B3", 2.0, "Sheet1") result = self.excel_driver_obj.read_cell_value("C2") self.assertIsNone(result) self.excel_driver_obj.set_cell_value("B4", math.pi, "Sheet1") result2 = self.excel_driver_obj.read_cell_value("C2") self.assertIsNotNone(result2) expected_result2 = 2.0 * math.sin( (1/2.0) * math.pi) self.assertEquals(expected_result2, result2)
class TestExcelDriverDummy(unittest.TestCase): def setUp(self): self.excel_driver_obj = ExcelDriverDummy() def test_basic_read_write(self): self.excel_driver_obj.set_cell_value("A1", 1.0, "Sheet1") self.excel_driver_obj.set_cell_value("A2", 2.0, "Sheet1") self.excel_driver_obj.set_cell_value("A3", 2.0, "Sheet1") a = self.excel_driver_obj.read_cell_value("A1", "Sheet1") self.assertEquals(1.0, a) b = self.excel_driver_obj.read_cell_value("A2", "Sheet1") self.assertEquals(2.0, b) def test_function_evaluation(self): self.excel_driver_obj.set_cell_value("B1", 1.5, "Sheet1") self.excel_driver_obj.set_cell_value("B2", 2.0, "Sheet1") self.excel_driver_obj.set_cell_value("B3", 2.0, "Sheet1") result = self.excel_driver_obj.read_cell_value("C2") self.assertIsNone(result) self.excel_driver_obj.set_cell_value("B4", math.pi, "Sheet1") result2 = self.excel_driver_obj.read_cell_value("C2") self.assertIsNotNone(result2) expected_result2 = 2.0 * math.sin((1 / 2.0) * math.pi) self.assertEquals(expected_result2, result2)
def setUp(self): self.excel_driver_obj = ExcelDriverDummy()