Merge pull request #375 from RPi-Distro/revert-374-test_rgbled_tweaks

Revert "Tweak RGBLED tests - increases coverage"
This commit is contained in:
Andrew Scheller
2016-06-10 12:32:56 +01:00
committed by GitHub

View File

@@ -410,17 +410,7 @@ def test_rgbled_initial_value_nonpwm():
def test_rgbled_initial_bad_value():
r, g, b = (MockPWMPin(i) for i in (1, 2, 3))
with pytest.raises(ValueError):
RGBLED(r, g, b, initial_value=(1.1, 0.2, 0.3))
with pytest.raises(ValueError):
RGBLED(r, g, b, initial_value=(0.1, 1.2, 0.3))
with pytest.raises(ValueError):
RGBLED(r, g, b, initial_value=(0.1, 0.2, 1.3))
with pytest.raises(ValueError):
RGBLED(r, g, b, initial_value=(-0.1, 0.2, 0.3))
with pytest.raises(ValueError):
RGBLED(r, g, b, initial_value=(0.1, -0.2, 0.3))
with pytest.raises(ValueError):
RGBLED(r, g, b, initial_value=(0.1, 0.2, -0.3))
RGBLED(r, g, b, initial_value=(0.1, 0.2, 1.2))
def test_rgbled_initial_bad_value_nonpwm():
r, g, b = (MockPin(i) for i in (1, 2, 3))
@@ -468,9 +458,6 @@ def test_rgbled_bad_value():
with RGBLED(r, g, b) as device:
with pytest.raises(ValueError):
device.value = (0, -1, 0)
with RGBLED(r, g, b) as device:
with pytest.raises(ValueError):
device.value = (0, 0, -0.5)
def test_rgbled_bad_value_nonpwm():
r, g, b = (MockPin(i) for i in (1, 2, 3))
@@ -635,9 +622,7 @@ def test_rgbled_fade_background_nonpwm():
r, g, b = (MockPin(i) for i in (1, 2, 3))
with RGBLED(r, g, b, pwm=False) as device:
with pytest.raises(ValueError):
device.blink(0, 0, 0.2, 0, n=2)
with pytest.raises(ValueError):
device.blink(0, 0, 0, 0.2, n=2)
device.blink(0, 0, 0.2, 0.2, n=2)
@pytest.mark.skipif(hasattr(sys, 'pypy_version_info'),
reason='timing is too random on pypy')
@@ -678,9 +663,7 @@ def test_rgbled_fade_foreground_nonpwm():
r, g, b = (MockPin(i) for i in (1, 2, 3))
with RGBLED(r, g, b, pwm=False) as device:
with pytest.raises(ValueError):
device.blink(0, 0, 0.2, 0, n=2, background=False)
with pytest.raises(ValueError):
device.blink(0, 0, 0, 0.2, n=2, background=False)
device.blink(0, 0, 0.2, 0.2, n=2, background=False)
@pytest.mark.skipif(hasattr(sys, 'pypy_version_info'),
reason='timing is too random on pypy')
@@ -723,7 +706,7 @@ def test_rgbled_pulse_background_nonpwm():
r, g, b = (MockPin(i) for i in (1, 2, 3))
with RGBLED(r, g, b, pwm=False) as device:
with pytest.raises(ValueError):
device.pulse(n=2)
device.pulse(0.2, 0.2, n=2)
@pytest.mark.skipif(hasattr(sys, 'pypy_version_info'),
reason='timing is too random on pypy')
@@ -764,7 +747,7 @@ def test_rgbled_pulse_foreground_nonpwm():
r, g, b = (MockPin(i) for i in (1, 2, 3))
with RGBLED(r, g, b, pwm=False) as device:
with pytest.raises(ValueError):
device.pulse(n=2, background=False)
device.pulse(0.2, 0.2, n=2, background=False)
def test_rgbled_blink_interrupt():
r, g, b = (MockPWMPin(i) for i in (1, 2, 3))