<s> import io <EOL> import msgpack <EOL> binarydata = bytes ( bytearray ( range ( <NUM_LIT> ) ) ) <EOL> def gen_binary_data ( idx ) : <EOL> return binarydata [ : idx % <NUM_LIT> ] <EOL> def test_exceeding_unpacker_read_size ( ) : <EOL> dumpf = io . BytesIO ( ) <EOL> packer = msgpack . Packer ( ) <EOL> NUMBER_OF_STRINGS = <NUM_LIT:6> <EOL> read_size = <NUM_LIT:16> <EOL> for idx in range ( NUMBER_OF_STRINGS ) : <EOL> data = gen_binary_data ( idx ) <EOL> dumpf . write ( packer . pack ( data ) ) <EOL> f = io . BytesIO ( dumpf . getvalue ( ) ) <EOL> dumpf . close ( ) <EOL> unpacker = msgpack . Unpacker ( f , read_size = read_size , use_list = <NUM_LIT:1> ) <EOL> read_count = <NUM_LIT:0> <EOL> for idx , o in enumerate ( unpacker ) : <EOL> assert type ( o ) == bytes <EOL> assert o == gen_binary_data ( idx ) <EOL> read_count += <NUM_LIT:1> <EOL> assert read_count == NUMBER_OF_STRINGS </s>
