示例#1
0
def test_HDDevice_convert_to_intensity_ValueError(percentage):

    device = HDDevice(TestData.power_hydra26hd()["devices"][0],
                      TestData.primary_mac_hydra26hd())

    with pytest.raises(ValueError):
        device.convert_to_intensity("uv", percentage)
示例#2
0
def test_HDDevice_convert_to_mw(power_response, primary_mac, intensity,
                                result_mw):

    device = HDDevice(power_response["devices"][0], primary_mac)

    for color in TestData.get_colors():

        assert result_mw[color] == device.convert_to_mw(color, intensity)
示例#3
0
def test_HDDevice_convert_to_intensity(power_response, primary_mac, percentage,
                                       result_intensities):

    device = HDDevice(power_response["devices"][0], primary_mac)

    for color in TestData.get_colors():

        assert result_intensities[color] == device.convert_to_intensity(
            color, percentage)
示例#4
0
def test_HDDevice_convert_to_percentage(power_response, primary_mac,
                                        resulting_percentage,
                                        input_intensities):

    device = HDDevice(power_response["devices"][0], primary_mac)

    for color in TestData.get_colors():

        assert resulting_percentage == round(
            device.convert_to_percentage(color, input_intensities[color]))
示例#5
0
def test_HDDevice_init(power_response, primary_mac, max_mw):

    device = HDDevice(power_response["devices"][0], primary_mac)

    assert device.is_primary
    assert device.max_mw == max_mw