def __post_init__(self): validate_dataclass(self) validate('Key.value', self.value, min_len=1, max_len=10, custom=pattern(r'[0-9A-Za-z_-]*'))
def __post_init__(self): validate_dataclass(self) validate('MenuDescription.value', self.value, min_len=1, max_len=1000, custom=pattern(r'[0-9A-Za-z ;.,_-]*'))
def test_regex_for_int(): assert pattern(r'\d+')('0') assert not pattern(r'\d+')('a')
def test_regex_for_single_word(): assert pattern(r'\w+')('abc') assert not pattern(r'\w+')('abc abc')
def __post_init__(self, ): validate_dataclass(self) validate('location', self.value, max_len=50, custom=pattern(r'^[a-zA-Z0-9 ]+$'))