<commit_before>from protobuf3.fields.base import BaseField
from protobuf3.fields.message import MessageField
from protobuf3.fields.string import StringField
from protobuf3.list_wrapper import ListWrapper
from protobuf3.message import Message
from unittest import TestCase


class TestBaseField(TestCase):
    def setUp(self):
        class EmptyMessage(Message):
            a = BaseField(field_number=1)

        class TestMessage(Message):
            a = StringField(field_number=1, repeated=True)
            b = StringField(field_number=2, repeated=True)

        raw_message = [
            0x0A, 0x07, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6E, 0x67,
            0x0A, 0x08, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6E, 0x67, 0x31
        ]

        self.empty_msg = EmptyMessage()
        self.repeated_msg = TestMessage()
        self.repeated_msg.parse_from_bytes(raw_message)

    def test_constructor_validation(self):
        self.assertRaises(AssertionError, BaseField, 'a')

    def test_default_value_handling(self):<commit_msg>Update base tests to reflect new behaviour.<commit_after>from protobuf3.fields.base import BaseField
from protobuf3.fields.message import MessageField
from protobuf3.fields.string import StringField
from protobuf3.list_wrapper import ListWrapper
from protobuf3.message import Message
from unittest import TestCase


class TestBaseField(TestCase):
    def setUp(self):
        class EmptyMessage(Message):
            a = BaseField(field_number=1)

        class TestMessage(Message):
            a = StringField(field_number=1, repeated=True)
            b = StringField(field_number=2, repeated=True)

        raw_message = bytes([
            0x0A, 0x07, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6E, 0x67,
            0x0A, 0x08, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6E, 0x67, 0x31
        ])

        self.empty_msg = EmptyMessage()
        self.repeated_msg = TestMessage()
        self.repeated_msg.parse_from_bytes(raw_message)

    def test_constructor_validation(self):
        self.assertRaises(AssertionError, BaseField, 'a')

    def test_default_value_handling(self):
{'fraction_non_alphanumeric': 0.08265647396082179, 'fraction_numerical': 0.05828953655040611, 'mean_word_length': 3.3807531380753137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1328919', 'n_tokens_mistral': 746, 'n_tokens_neox': 663, 'n_words': 150}