コード例 #1
0
def test_decode_data():
    """
    Test the DATA frame is decoded correctly.
    """
    frame = KISSCommand.decode(b'\x90this is a data frame')
    assert isinstance(frame, KISSCmdData)
    eq_(frame.payload, b'this is a data frame')
コード例 #2
0
def test_decode_unknown():
    """
    Test unknown KISS frames are decoded to the base KISSCommand base class.
    """
    frame = KISSCommand.decode(b'\x58unknown command payload')
    assert isinstance(frame, KISSCommand)
    eq_(frame.cmd, 8)
    eq_(frame.port, 5)
    eq_(frame.payload, b'unknown command payload')