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)
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)
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)
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]))
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