def test_validate_with_instance_level_validators():
    class Player(Model):
        id = IntType()

        def validate_id(self, data, value, context):
            if p1._initial['id'] != value:
                p1._data['id'] = p1._initial['id']
                raise ValidationError('Cannot change id')

    p1 = Player({'id': 4})
    p1.id = 3

    try:
        validate(Player, p1)
    except DataError as e:
        assert 'id' in e.messages
        assert e.messages['id'] in 'Cannot change id'
        assert p1.id == 4
dataset/ETHPy150Open schematics/schematics/tests/test_functional.py/test_validate_with_instance_level_validators/swapped operands of `in`