# 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
        class StringTestMessage(Message):
            b = StringField(field_number=1, required=1)

        msg = StringTestMessage()
        self.assertRaises(KeyError, msg._check_required_fields)

    def test_get_wire_values(self):
        tmp = Message()

        data = bytes([0x08, 0x96, 0x01])
        tmp.parse_from_bytes(data)
        self.assertEqual(tmp._get_wire_values(1), [WireField(type=FIELD_VARINT, value=150)])

    def test_set_wire_values(self):
        tmp = Message()

        tmp._set_wire_values(1, FIELD_VARINT, 150)
        self.assertDictEqual(tmp._Message__wire_message,
                             {1: [WireField(type=FIELD_VARINT, value=150)]})

    def test_parse_from_bytes(self):
        tmp = Message()

        data = bytes([0x08, 0x96, 0x01])
        expected_message = {1: [WireField(type=FIELD_VARINT, value=150)]}
        tmp.parse_from_bytes(data)
        self.assertDictEqual(tmp._Message__wire_message, expected_message)

    def test_create_from_bytes(self):
        data = bytes([0x08, 0x96, 0x01])

# 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

        class StringTestMessage(Message):
            b = StringField(field_number=1, required=1)

        msg = StringTestMessage()
        self.assertRaises(KeyError, msg._check_required_fields)

    def test_get_wire_values(self):
        tmp = Message()

        data = bytes([0x08, 0x96, 0x01])
        tmp.parse_from_bytes(data)
        self.assertEqual(tmp._get_wire_values(1), [WireField(type=FIELD_VARINT, value=150)])

    def test_set_wire_values(self):
        tmp = Message()

        tmp._set_wire_values(1, FIELD_VARINT, 150)
        self.assertDictEqual(tmp._Message__wire_message,
                             {1: [WireField(type=FIELD_VARINT, value=150)]})

    def test_parse_from_bytes(self):
        tmp = Message()

        data = bytes([0x08, 0x96, 0x01])
        expected_message = {1: [WireField(type=FIELD_VARINT, value=150)]}
        tmp.parse_from_bytes(data)
        self.assertDictEqual(tmp._Message__wire_message, expected_message)

    def test_create_from_bytes(self):
        data = bytes([0x08, 0x96, 0x01])

        expected_message = {1: [WireField(type=FIELD_VARINT, value=150)]}