MCPcopy
hub / github.com/django/django / test_raw

Method test_raw

tests/multiple_database/tests.py:1242–1253  ·  view source on GitHub ↗

test the raw() method across databases

(self)

Source from the content-addressed store, hash-verified

1240 self.assertEqual(dive.get_previous_by_published().title, "Learning Python")
1241
1242 def test_raw(self):
1243 "test the raw() method across databases"
1244 dive = Book.objects.using("other").create(
1245 title="Dive into Python", published=datetime.date(2009, 5, 4)
1246 )
1247 val = Book.objects.db_manager("other").raw(
1248 "SELECT id FROM multiple_database_book"
1249 )
1250 self.assertQuerySetEqual(val, [dive.pk], attrgetter("pk"))
1251
1252 val = Book.objects.raw("SELECT id FROM multiple_database_book").using("other")
1253 self.assertQuerySetEqual(val, [dive.pk], attrgetter("pk"))
1254
1255 def test_select_related(self):
1256 """

Callers

nothing calls this directly

Calls 5

db_managerMethod · 0.80
assertQuerySetEqualMethod · 0.80
createMethod · 0.45
usingMethod · 0.45
rawMethod · 0.45

Tested by

no test coverage detected