MCPcopy
hub / github.com/django/django / test_update

Method test_update

tests/get_or_create/tests.py:296–308  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

294
295class UpdateOrCreateTests(TestCase):
296 def test_update(self):
297 Person.objects.create(
298 first_name="John", last_name="Lennon", birthday=date(1940, 10, 9)
299 )
300 p, created = Person.objects.update_or_create(
301 first_name="John",
302 last_name="Lennon",
303 defaults={"birthday": date(1940, 10, 10)},
304 )
305 self.assertFalse(created)
306 self.assertEqual(p.first_name, "John")
307 self.assertEqual(p.last_name, "Lennon")
308 self.assertEqual(p.birthday, date(1940, 10, 10))
309
310 def test_create(self):
311 p, created = Person.objects.update_or_create(

Callers

nothing calls this directly

Calls 3

dateFunction · 0.85
createMethod · 0.45
update_or_createMethod · 0.45

Tested by

no test coverage detected