

def testGetOrCreate(self):
    objects = self.mapper[SimpleModel]
    (v, created) = (yield objects.update_or_create(code='test'))
    self.assertTrue(created)
    self.assertEqual(v.code, 'test')
    (v2, created) = (yield objects.update_or_create(code='test'))
    self.assertFalse(created)
    self.assertEqual(v, v2)

dataset/ETHPy150Open lsbardel/python-stdnet/tests/all/query/manager.py TestManager.testGetOrCreate/original