Ticket #26884: 26884.diff

File 26884.diff, 1.0 KB (added by Jensen Cochran, 8 years ago)
  • tests/get_or_create/tests.py

    diff --git a/tests/get_or_create/tests.py b/tests/get_or_create/tests.py
    index 84f8261..7decdeb 100644
    a b class UpdateOrCreateTests(TestCase):  
    407407        self.assertFalse(created)
    408408        self.assertEqual(obj.defaults, 'another testing')
    409409
    410     def test_update_callable_default(self):
     410    def test_create_callable_default(self):
    411411        obj, created = Person.objects.update_or_create(
    412412            first_name='George', last_name='Harrison',
    413413            defaults={'birthday': lambda: date(1943, 2, 25)},
    414414        )
    415415        self.assertEqual(obj.birthday, date(1943, 2, 25))
     416
     417    def test_update_callable_default(self):
     418        Person.objects.update_or_create(first_name='George', last_name='Harrison', birthday=date(1942, 2, 25))
     419        obj, created = Person.objects.update_or_create(
     420            first_name='George',
     421            defaults={'last_name': lambda: 'NotHarrison'},
     422        )
     423        self.assertEqual(obj.last_name, 'NotHarrison')
Back to Top