def delete(query, recursive=False, delete_nullable=False): if isinstance(query, DeleteQuery): return delete(query) else: return delete_object(query, recursive=recursive, delete_nullable=delete_nullable)
def test(database): text = "Test %s" % uuid.uuid4() obj1 = yield from peewee_async.create_object(TestModel, text=text) obj2 = yield from peewee_async.get_object(TestModel, TestModel.id == obj1.id) yield from peewee_async.delete_object(obj2) try: obj3 = yield from peewee_async.get_object( TestModel, TestModel.id == obj1.id) except TestModel.DoesNotExist: obj3 = None self.assertTrue(obj3 is None, "Error, object wasn't deleted")
def test(database): text = "Test %s" % uuid.uuid4() obj1 = yield from peewee_async.create_object( TestModel, text=text) obj2 = yield from peewee_async.get_object( TestModel, TestModel.id == obj1.id) yield from peewee_async.delete_object(obj2) try: obj3 = yield from peewee_async.get_object( TestModel, TestModel.id == obj1.id) except TestModel.DoesNotExist: obj3 = None self.assertTrue(obj3 is None, "Error, object wasn't deleted")