def test_read_position(mockHardware: MockHardware, value, expected): mockHardware.set_ADC_u16_value(k1, value) assert k1.read_position() == expected
def test_knobs_are_independent(mockHardware: MockHardware): mockHardware.set_ADC_u16_value(k1, 0) mockHardware.set_ADC_u16_value(k2, MAX_UINT16) assert k1.percent() == 1.0 assert k2.percent() == 0.0
def test_percent(mockHardware: MockHardware, value, expected): mockHardware.set_ADC_u16_value(k1, value) assert round(k1.percent(), 4) == expected
def test_choice(mockHardware: MockHardware, analogueReader, values, value, expected): mockHardware.set_ADC_u16_value(analogueReader, value) assert analogueReader.choice(values) == expected
def test_range(mockHardware: MockHardware, analogueReader, value, expected): mockHardware.set_ADC_u16_value(analogueReader, value) assert analogueReader.range() == expected
def test_percent(mockHardware: MockHardware, analogueReader, value, expected): mockHardware.set_ADC_u16_value(analogueReader, value) assert round(analogueReader.percent(), 4) == expected
def mockHardware(monkeypatch): return MockHardware(monkeypatch)