

def _assert_unique_key_constraint(self, instance):
    self.assertIsNone(getattr(instance, 'id', None))
    saved = self.access_type.add_or_update(instance)
    self.assertIsNotNone(saved.id)
    delattr(instance, 'id')
    saved.assertRaises(StackStormDBObjectConflictError, self.access_type.add_or_update, instance)

dataset/ETHPy150Open StackStorm/st2/st2tests/st2tests/base.py DbModelTestCase._assert_unique_key_constraint/VarMisuse@53/71 `self`->`saved`