def test_cycle_speed_hex_returns_hex_value(self): light = PyCololight("1.1.1.1") expected_responses = ["01", "20", "0d", "0b"] test_cycle_speeds = [(32, 1), (1, 1), (20, 1), (2, 2)] for index, test_speed in enumerate(test_cycle_speeds): cycle_speed = test_speed[0] mode = test_speed[1] cycle_speed_hex = light._cycle_speed_hex(cycle_speed, mode) assert cycle_speed_hex == expected_responses[index]
def test_cycle_speed_hex_raises_exeception_when_bad_speed(self): light = PyCololight("1.1.1.1") with pytest.raises(CycleSpeedException): light._cycle_speed_hex(35, 1)