MCPcopy
hub / github.com/django/django / test_pyformat_params

Method test_pyformat_params

tests/raw_query/tests.py:246–258  ·  view source on GitHub ↗

Test passing optional query parameters

(self)

Source from the content-addressed store, hash-verified

244
245 @skipUnlessDBFeature("supports_paramstyle_pyformat")
246 def test_pyformat_params(self):
247 """
248 Test passing optional query parameters
249 """
250 query = "SELECT * FROM raw_query_author WHERE first_name = %(first)s"
251 author = Author.objects.all()[2]
252 params = {"first": author.first_name}
253 qset = Author.objects.raw(query, params=params)
254 results = list(qset)
255 self.assertProcessed(Author, results, [author])
256 self.assertNoAnnotations(results)
257 self.assertEqual(len(results), 1)
258 self.assertIsInstance(repr(qset), str)
259
260 def test_query_representation(self):
261 """

Callers

nothing calls this directly

Calls 4

assertProcessedMethod · 0.95
assertNoAnnotationsMethod · 0.95
allMethod · 0.45
rawMethod · 0.45

Tested by

no test coverage detected