@staticmethod
def test_binary_tgwriter_tgreader():
    small_data = os.urandom(33)
    small_data_padded = os.urandom(19)
    large_data = os.urandom(999)
    large_data_padded = os.urandom(1024)
    data = (small_data, small_data_padded, large_data, large_data_padded)
    string = 'Testing Telegram strings, this should work properly!'
    serialized = (b''.join((TLObject.serialize_bytes(d) for d in data)) + TLObject.serialize_bytes(string))
    with BinaryReader(serialized) as reader:
        for datum in data:
            value = reader.tgread_bytes()
            assert (value == datum), 'Example bytes should be {} but is {}'.format(datum, value)
        value = reader.tgread_string()
        assert (value == string), 'Example string should be {} but is {}'.format(string, value)
@staticmethod
def test_binary_tgwriter_tgreader():
    small_data = os.urandom(33)
    small_data_padded = os.urandom(19)
    large_data = os.urandom(999)
    large_data_padded = os.urandom(1024)
    data = (small_data, small_data_padded, large_data, large_data_padded)
    string = 'Testing Telegram strings, this should work properly!'
    serialized = (b.join((TLObject.serialize_bytes(d) for d in data)) + TLObject.serialize_bytes(string))
    with BinaryReader(serialized) as reader:
        for datum in data:
            value = reader.tgread_bytes()
            assert (value == datum), 'Example bytes should be {} but is {}'.format(datum, value)
        value = reader.tgread_string()
        assert (value == string), 'Example string should be {} but is {}'.format(string, value)