Пример #1
0
def test_data_frame_data():

    frame = DataFrame(id=0x0201)

    # set data as default html format
    frame.set_text(u'<html><heade></heade><body></body></html>', 'utf-8')

    assert frame.type == FrameType.DATA

    read_frame = Frame.load(frame.get_frame_bin())

    assert read_frame.data == frame.data  # check is same data
Пример #2
0
def test_padded_data_frame_data():

    frame = DataFrame(id=0x0201)

    # set data as default html format
    data = u'<html><heade></heade><body></body></html>'
    frame.set_text(data, 'utf-8')
    frame.padding(10)

    assert frame.type == FrameType.DATA
    read_frame = Frame.load(frame.get_frame_bin())

    assert read_frame.data == data.encode('utf-8')  # check is same data