def test_handcrafted_options_0(): opts = Options.unpack( HANDCRAFTED_OPTIONS[0], names={'comment': 0x0001}, endianness=1) assert len(opts) == 1 assert opts['comment'] == 'Hello world' assert opts.get_values('comment') == ['Hello world'] assert opts.pack(endianness=1) == HANDCRAFTED_OPTIONS[0]
def test_handcrafted_options_1(): opts = Options.unpack( HANDCRAFTED_OPTIONS[1], names={'comment': 0x0001, 'example': 0xff02}, endianness=1) assert len(opts) == 2 assert opts['comment'] == 'Hello world' assert opts['example'] == 'Example value' assert opts.get_values('comment') == [ 'Hello world', 'This is another comment'] assert opts.pack(endianness=1) == HANDCRAFTED_OPTIONS[1]