# Path: protobuf3/fields/string.py
# class StringField(BaseField):
#     DEFAULT_VALUE = ""
#     WIRE_TYPE = FIELD_VARIABLE_LENGTH
# 
#     def _convert_to_final_type(self, value):
#         return value.decode()
# 
#     def _convert_to_wire_type(self, value):
#         return value.encode()
# 
#     def _validate(self, value):
#         return isinstance(value, str)
# 
# Path: protobuf3/message.py
# class Message(object):
#     def __load_django_style_fields(cls):
#     def __new__(cls, *args, **kwargs):
#     def add_field(cls, field_name, field_instance):
#     def __init__(self):
#     def _decode_field_signature(self, data):
#     def _encode_field_signature(field_type, field_number, field_length=None):
#     def _decode_varint(self, data):
#     def _encode_varint(number):
#     def _decode_raw_message(self, data):
#         def __read_n_bytes(n):
#     def _check_required_fields(self):
#     def _get_wire_values(self, field_number):
#     def _set_parent(self, parent_msg):
#     def _set_wire_values(self, field_number, field_type, field_value, index=None, insert=False,
#                          append=False, remove=False):
#     def _drop_wire_value(self, field_number):
#     def parse_from_bytes(self, bytes_array):
#     def create_from_bytes(cls, bytes_array):
#     def encode_to_bytes(self, ignore_unknown=False):
#     def __contains__(self, item):
#     def __repr__(self):
# 
# Path: protobuf3/wire_types.py
# FIELD_VARINT = 0
# 
# FIELD_FIXED64 = 1
# 
# FIELD_VARIABLE_LENGTH = 2
# 
# FIELD_FIXED32 = 5


from protobuf3.fields.string import StringField
from protobuf3.message import Message, WireField
from protobuf3.wire_types import FIELD_VARINT, FIELD_FIXED64, FIELD_VARIABLE_LENGTH, FIELD_FIXED32
from unittest import TestCase
            a = StringField(field_number=2, optional=True)

        msg = TestMsg()

        self.assertEqual('b' in msg, False)

        self.assertEqual('a' in msg, False)

        msg.parse_from_bytes(b'\x12\x07\x74\x65\x73\x74\x69\x6E\x67')
        self.assertEqual('a' in msg, True)

    def test_remove_field_value(self):
        class TestMsg(Message):
            a = StringField(field_number=1, optional=True)
            b = StringField(field_number=2, repeated=True)

        msg = TestMsg()
        msg.a = 'asd'
        self.assertEqual('a' in msg, True)
        del msg.a
        self.assertEqual('a' in msg, False)

        msg.b.append('1')
        msg.b.append('2')
        self.assertEqual('b' in msg, True)
        del msg.b
        self.assertEqual('b' in msg, False)

    def test_repr(self):
        class EncodedMessage(Message):

# Path: protobuf3/fields/string.py
# class StringField(BaseField):
#     DEFAULT_VALUE = ""
#     WIRE_TYPE = FIELD_VARIABLE_LENGTH
# 
#     def _convert_to_final_type(self, value):
#         return value.decode()
# 
#     def _convert_to_wire_type(self, value):
#         return value.encode()
# 
#     def _validate(self, value):
#         return isinstance(value, str)
# 
# Path: protobuf3/message.py
# class Message(object):
#     def __load_django_style_fields(cls):
#     def __new__(cls, *args, **kwargs):
#     def add_field(cls, field_name, field_instance):
#     def __init__(self):
#     def _decode_field_signature(self, data):
#     def _encode_field_signature(field_type, field_number, field_length=None):
#     def _decode_varint(self, data):
#     def _encode_varint(number):
#     def _decode_raw_message(self, data):
#         def __read_n_bytes(n):
#     def _check_required_fields(self):
#     def _get_wire_values(self, field_number):
#     def _set_parent(self, parent_msg):
#     def _set_wire_values(self, field_number, field_type, field_value, index=None, insert=False,
#                          append=False, remove=False):
#     def _drop_wire_value(self, field_number):
#     def parse_from_bytes(self, bytes_array):
#     def create_from_bytes(cls, bytes_array):
#     def encode_to_bytes(self, ignore_unknown=False):
#     def __contains__(self, item):
#     def __repr__(self):
# 
# Path: protobuf3/wire_types.py
# FIELD_VARINT = 0
# 
# FIELD_FIXED64 = 1
# 
# FIELD_VARIABLE_LENGTH = 2
# 
# FIELD_FIXED32 = 5


# Path: tests/test_message.py
from protobuf3.fields.string import StringField
from protobuf3.message import Message, WireField
from protobuf3.wire_types import FIELD_VARINT, FIELD_FIXED64, FIELD_VARIABLE_LENGTH, FIELD_FIXED32
from unittest import TestCase

            a = StringField(field_number=2, optional=True)

        msg = TestMsg()

        self.assertEqual('b' in msg, False)

        self.assertEqual('a' in msg, False)

        msg.parse_from_bytes(b'\x12\x07\x74\x65\x73\x74\x69\x6E\x67')
        self.assertEqual('a' in msg, True)

    def test_remove_field_value(self):
        class TestMsg(Message):
            a = StringField(field_number=1, optional=True)
            b = StringField(field_number=2, repeated=True)

        msg = TestMsg()
        msg.a = 'asd'
        self.assertEqual('a' in msg, True)
        del msg.a
        self.assertEqual('a' in msg, False)

        msg.b.append('1')
        msg.b.append('2')
        self.assertEqual('b' in msg, True)
        del msg.b
        self.assertEqual('b' in msg, False)

    def test_repr(self):
        class EncodedMessage(Message):

            a = StringField(field_number=2, required=True)