MCPcopy
hub / github.com/django/django / test_missing_fields_fetch_mode_raise

Method test_missing_fields_fetch_mode_raise

tests/raw_query/tests.py:321–329  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

319 authors[1].last_name
320
321 def test_missing_fields_fetch_mode_raise(self):
322 query = "SELECT id, first_name, dob FROM raw_query_author"
323 authors = list(Author.objects.fetch_mode(RAISE).raw(query))
324 msg = "Fetching of Author.last_name blocked."
325 with self.assertRaisesMessage(FieldFetchBlocked, msg) as cm:
326 authors[0].last_name
327 self.assertIsNone(cm.exception.__cause__)
328 self.assertTrue(cm.exception.__suppress_context__)
329 self.assertTrue(cm.exception.__suppress_context__)
330
331 def test_annotations(self):
332 query = (

Callers

nothing calls this directly

Calls 3

fetch_modeMethod · 0.80
assertRaisesMessageMethod · 0.80
rawMethod · 0.45

Tested by

no test coverage detected