コード例 #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)
コード例 #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())
コード例 #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)
コード例 #4
0
ファイル: test_usblight.py プロジェクト: sammyrTX/busylight
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())
コード例 #5
0
def supported_lights() -> list:
    """A list of supported USBLight subclasses."""

    return USBLight.supported_lights()
コード例 #6
0
def test_usblight_all_lights():

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