def test_actual_data(self): calibrator = Calibrator(32768, 120) self.assertAlmostEqual(calibrator.flow(32780), 0.1, msg="Fails to return a reasonable value " "given actual data the sensor could " "return.")
def test_one_parameters_and_data(self): calibrator = Calibrator(1, 1) self.assertAlmostEqual(calibrator.flow(1), 0.0, msg="Fails to return 0.0 when measured " "value, offset flow, and scale factor " "flow are one.")
def test_zero_one_parameters_and_zero_data(self): calibrator = Calibrator(0, 1) self.assertAlmostEqual(calibrator.flow(0), 0.0, msg="Fails to return 0.0 when measured " "value and offset flow are zero and " "scale factor flow is non-zero.")
def test_one_parameters_and_large_data(self): calibrator = Calibrator(1, 1) self.assertAlmostEqual(calibrator.flow(10), 9.0, msg="Fails to return the correct value " "when the result is non-zero.")
def test_zero_scale_factor_flow(self): with self.assertRaises(ZeroDivisionError, msg="Fails to raise a ZeroDivisionError " "when initialized with a scale factor " "flow equal to 0."): Calibrator(0, 0)