예제 #1
0
def test_read_position(mockHardware: MockHardware, value, expected):
    mockHardware.set_ADC_u16_value(k1, value)

    assert k1.read_position() == expected
예제 #2
0
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
예제 #3
0
def test_percent(mockHardware: MockHardware, value, expected):
    mockHardware.set_ADC_u16_value(k1, value)

    assert round(k1.percent(), 4) == expected
예제 #4
0
def test_choice(mockHardware: MockHardware, analogueReader, values, value,
                expected):
    mockHardware.set_ADC_u16_value(analogueReader, value)

    assert analogueReader.choice(values) == expected
예제 #5
0
def test_range(mockHardware: MockHardware, analogueReader, value, expected):
    mockHardware.set_ADC_u16_value(analogueReader, value)

    assert analogueReader.range() == expected
예제 #6
0
def test_percent(mockHardware: MockHardware, analogueReader, value, expected):
    mockHardware.set_ADC_u16_value(analogueReader, value)

    assert round(analogueReader.percent(), 4) == expected
예제 #7
0
def mockHardware(monkeypatch):
    return MockHardware(monkeypatch)