コード例 #1
0
ファイル: roll_test.py プロジェクト: AGenews/kulka
def test_valid_input(arg1, arg2, arg3):
    expected = bytearray([0xFF, 0xFF, 0x2, 0x30, 0x00, 0x05,
                          arg1, (arg2 >> 8), (arg2 & 0xFF), arg3])
    expected.append((sum(expected[2:]) & 0xFF) ^ 0xFF)

    request = Roll(arg1, arg2, arg3)
    assert request.tobytes() == expected
コード例 #2
0
def test_valid_input(arg1, arg2, arg3):
    expected = bytearray([
        0xFF, 0xFF, 0x2, 0x30, 0x00, 0x05, arg1, (arg2 >> 8), (arg2 & 0xFF),
        arg3
    ])
    expected.append((sum(expected[2:]) & 0xFF) ^ 0xFF)

    request = Roll(arg1, arg2, arg3)
    assert request.tobytes() == expected
コード例 #3
0
ファイル: roll_test.py プロジェクト: AGenews/kulka
def test_example_input():
    expected = bytearray([0xFF, 0xFF, 0x02, 0x30, 0x00, 0x05,
                          0x10, 0x20, 0x30, 0x40, 0x28])
    request = Roll(16, 8240, 64)
    assert request.tobytes() == expected
コード例 #4
0
ファイル: roll_test.py プロジェクト: AGenews/kulka
def test_input_below_range(arg1, arg2, arg3):
    request = Roll(arg1, arg2, arg3)

    with pytest.raises(ValueError):
        request.tobytes()
コード例 #5
0
def test_example_input():
    expected = bytearray(
        [0xFF, 0xFF, 0x02, 0x30, 0x00, 0x05, 0x10, 0x20, 0x30, 0x40, 0x28])
    request = Roll(16, 8240, 64)
    assert request.tobytes() == expected
コード例 #6
0
def test_input_below_range(arg1, arg2, arg3):
    request = Roll(arg1, arg2, arg3)

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