'Test to verify restrictions are honored and that validate is called
on the default value
@since 3.10
@jira_ticket PYTHON-505
@expected_result a validation error is arisen due to the name being
too long
@test_category data_types:object_mapper'

def test_udt_validate_with_default(self):

    class UserValidateDefault(UserType, ):
        age = columns.Integer()
        name = columns.Text(max_length=2, default='Robert')
    class UserModelValidateDefault(Model, ):
        id = columns.Integer(primary_key=True)
        info = columns.UserDefinedType(UserValidateDefault)
    sync_table(UserModelValidateDefault)
    self.addCleanup(drop_table, UserModelValidateDefault)
    user = UserValidateDefault(age=1)
    item = UserModelValidateDefault(id=1, info=user)
    with self.assertRaises(ValidationError):
        item.save()
