def test_signal_rpm_special_method_repr(): """ expect a __repr__ format """ with mock.patch('mycodo.inputs.signal_rpm.SignalRPMInput.get_measurement') as mock_measure: mock_measure.side_effect = [0.0] signal_rpm = SignalRPMInput(None, testing=True) signal_rpm.read() assert "<SignalRPMInput(rpm=0.00)>" in repr(signal_rpm)
def test_signal_rpm_read_updates_temp(): """ Verify that SignalRPMInput(0x99, 1).read() gets the average temp """ with mock.patch('mycodo.inputs.signal_rpm.SignalRPMInput.get_measurement') as mock_measure: mock_measure.side_effect = [67, 52] signal_rpm = SignalRPMInput(None, testing=True) assert signal_rpm._rpm is None assert not signal_rpm.read() assert signal_rpm._rpm == 67.0 assert not signal_rpm.read() assert signal_rpm._rpm == 52.0
def test_signal_rpm_condition_properties(): """ verify rpm property """ with mock.patch('mycodo.inputs.signal_rpm.SignalRPMInput.get_measurement') as mock_measure: mock_measure.side_effect = [67, 52] signal_rpm = SignalRPMInput(None, testing=True) assert signal_rpm._rpm is None assert signal_rpm.rpm == 67.00 assert signal_rpm.rpm == 67.00 assert not signal_rpm.read() assert signal_rpm.rpm == 52.00