MCPcopy
hub / github.com/django/django / assertProcessed

Method assertProcessed

tests/raw_query/tests.py:90–109  ·  view source on GitHub ↗

Compare the results of a raw query against expected results

(self, model, results, orig, expected_annotations=())

Source from the content-addressed store, hash-verified

88 self.assertAnnotations(results, expected_annotations)
89
90 def assertProcessed(self, model, results, orig, expected_annotations=()):
91 """
92 Compare the results of a raw query against expected results
93 """
94 self.assertEqual(len(results), len(orig))
95 for index, item in enumerate(results):
96 orig_item = orig[index]
97 for annotation in expected_annotations:
98 setattr(orig_item, *annotation)
99
100 for field in model._meta.fields:
101 # All values on the model are equal
102 self.assertEqual(
103 getattr(item, field.attname), getattr(orig_item, field.attname)
104 )
105 # This includes checking that they are the same type
106 self.assertEqual(
107 type(getattr(item, field.attname)),
108 type(getattr(orig_item, field.attname)),
109 )
110
111 def assertNoAnnotations(self, results):
112 """

Callers 3

test_paramsMethod · 0.95
test_pyformat_paramsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected