MCPcopy
hub / github.com/django/django / test_multiple_fields

Method test_multiple_fields

tests/queries/test_bulk_update.py:55–68  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

53 )
54
55 def test_multiple_fields(self):
56 for note in self.notes:
57 note.note = "test-%s" % note.id
58 note.misc = "misc-%s" % note.id
59 with self.assertNumQueries(1):
60 Note.objects.bulk_update(self.notes, ["note", "misc"])
61 self.assertCountEqual(
62 Note.objects.values_list("note", flat=True),
63 [cat.note for cat in self.notes],
64 )
65 self.assertCountEqual(
66 Note.objects.values_list("misc", flat=True),
67 [cat.misc for cat in self.notes],
68 )
69
70 def test_batch_size(self):
71 with self.assertNumQueries(len(self.notes)):

Callers

nothing calls this directly

Calls 3

assertNumQueriesMethod · 0.80
values_listMethod · 0.80
bulk_updateMethod · 0.45

Tested by

no test coverage detected