Example #1
0
def test_valid_input(arg1, arg2, arg3, arg4):
    expected = bytearray(
        [0xFF, 0xFF, 0x02, 0x20, 0x00, 0x05, arg1, arg2, arg3, arg4])
    expected.append((sum(expected[2:]) & 0xFF) ^ 0xFF)

    request = SetRGB(arg1, arg2, arg3, arg4)
    assert request.tobytes() == expected
Example #2
0
def test_valid_input(arg1, arg2, arg3, arg4):
    expected = bytearray([0xFF, 0xFF, 0x02, 0x20, 0x00, 0x05,
                          arg1, arg2, arg3, arg4])
    expected.append((sum(expected[2:]) & 0xFF) ^ 0xFF)

    request = SetRGB(arg1, arg2, arg3, arg4)
    assert request.tobytes() == expected
Example #3
0
def test_example_input():
    expected = bytearray(
        [0xFF, 0xFF, 0x02, 0x20, 0x00, 0x05, 0x10, 0x10, 0x10, 0x00, 0xA8])
    request = SetRGB(16, 16, 16, 0)
    assert request.tobytes() == expected
Example #4
0
def test_input_below_range(arg1, arg2, arg3):
    request = SetRGB(arg1, arg2, arg3)

    with pytest.raises(ValueError):
        request.tobytes()
Example #5
0
def test_example_input():
    expected = bytearray([0xFF, 0xFF, 0x02, 0x20, 0x00, 0x05,
                          0x10, 0x10, 0x10, 0x00, 0xA8])
    request = SetRGB(16, 16, 16, 0)
    assert request.tobytes() == expected
Example #6
0
def test_input_below_range(arg1, arg2, arg3):
    request = SetRGB(arg1, arg2, arg3)

    with pytest.raises(ValueError):
        request.tobytes()