Test passing optional query parameters
(self)
| 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 | """ |
nothing calls this directly
no test coverage detected