def test(database): text = "Test %s" % uuid.uuid4() obj1 = yield from peewee_async.create_object(TestModel, text=text) obj1.text = "Test update object" yield from peewee_async.update_object(obj1) obj2 = yield from peewee_async.get_object(TestModel, TestModel.id == obj1.id) self.assertEqual(obj2.text, "Test update object")
def test(database): text = "Test %s" % uuid.uuid4() obj1 = yield from peewee_async.create_object( TestModel, text=text) obj1.text = "Test update object" yield from peewee_async.update_object(obj1) obj2 = yield from peewee_async.get_object( TestModel, TestModel.id == obj1.id) self.assertEqual(obj2.text, "Test update object")
def update(query, only=None): if isinstance(query, UpdateQuery): return update(query) else: return update_object(query, only=only)