1def test_update_result(self):
2 obj = MyModel.objects.create(val=1)
3 MyModel.objects.filter(pk=obj.pk).update(val=F('val') + 1)
4 # At this point obj.val is still 1, but the value in the database
5 # was updated to 2. The object's updated value needs to be reloaded
6 # from the database.
7 obj.refresh_from_db()
8 self.assertEqual(obj.val, 2)
9