Exemplo n.º 1
0
def test_usblight_create_fails():
    """USBLight is an abstract base class which may not be
    instantiated directly.
    """

    with pytest.raises(TypeError, match="abstract methods"):
        u = USBLight(0, 0, b"path", False)
Exemplo n.º 2
0
def test_usblight_first_light():
    """The first_light() classmethod returns a configured
    light or raises USBLightNotFound when no more lights
    can be located.
    """
    with pytest.raises(USBLightNotFound):
        lights = []
        while True:
            lights.append(USBLight.first_light())
Exemplo n.º 3
0
def test_supported_lights():
    """The supported_lights() classmethod returns a list of
    USBLight concrete subclasses.
    """
    supported_lights = USBLight.supported_lights()

    assert isinstance(supported_lights, list)
    for light in supported_lights:
        assert issubclass(light, USBLight)
Exemplo n.º 4
0
def test_usblight_first_light():
    """The first_light() classmethod returns a configured
    light or raises USBLightNotFound when no more lights
    can be located.

    For this test, we keep references to each light in a
    list to keep them from being released and re-found by
    the `first_light` method.
    """
    with pytest.raises(USBLightNotFound):
        lights = []
        while True:
            lights.append(USBLight.first_light())
Exemplo n.º 5
0
def supported_lights() -> list:
    """A list of supported USBLight subclasses."""

    return USBLight.supported_lights()
Exemplo n.º 6
0
def test_usblight_all_lights():

    result = USBLight.all_lights()
    assert isinstance(result, list)