diff --git a/pioreactor/background_jobs/od_reading.py b/pioreactor/background_jobs/od_reading.py index e51112e4..0633d7e3 100644 --- a/pioreactor/background_jobs/od_reading.py +++ b/pioreactor/background_jobs/od_reading.py @@ -617,10 +617,10 @@ def pop_reference_reading(self, batched_readings: PdChannelToVoltage) -> pt.Volt class CalibrationTransformer(LoggerMixin): _logger_name = "calibration_transformer" - models: dict[pt.PdChannel, Callable] = {} def __init__(self) -> None: super().__init__() + self.models: dict[pt.PdChannel, Callable] = {} def __call__(self, batched_readings: PdChannelToVoltage) -> PdChannelToVoltage: return batched_readings @@ -629,6 +629,7 @@ def __call__(self, batched_readings: PdChannelToVoltage) -> PdChannelToVoltage: class NullCalibrationTransformer(CalibrationTransformer): def __init__(self) -> None: super().__init__() + self.models: dict[pt.PdChannel, Callable] = {} def hydate_models(self, calibration_data: structs.ODCalibration | None) -> None: return @@ -637,6 +638,7 @@ def hydate_models(self, calibration_data: structs.ODCalibration | None) -> None: class CachedCalibrationTransformer(CalibrationTransformer): def __init__(self) -> None: super().__init__() + self.models: dict[pt.PdChannel, Callable] = {} self.has_logged_warning = False def hydate_models(self, calibration_data: structs.ODCalibration | None) -> None: diff --git a/pioreactor/tests/test_od_reading.py b/pioreactor/tests/test_od_reading.py index 731ce3e0..18b54217 100644 --- a/pioreactor/tests/test_od_reading.py +++ b/pioreactor/tests/test_od_reading.py @@ -614,6 +614,7 @@ def test_calibration_not_present() -> None: c.pop("od") cal = load_active_calibration("od") + assert cal is None with start_od_reading("90", "REF", interval=None, fake_data=True, calibration=cal) as od: assert isinstance(od.calibration_transformer, NullCalibrationTransformer)