def test_count_queries():
with count_queries() as counts:
spatial = Spatial.objects.create(geographic_name="paikka")
spatial.refresh_from_db()
Provenance.objects.create(title={"en": "hello"}, spatial=spatial)
Provenance.objects.create(title={"en": "world"})
Provenance.objects.filter(title__en="hello").update(title={"fi": "moro"})
Provenance.objects.all().delete()
assert counts == {
"SQLCompiler": Counter({"total": 1, "Spatial": 1}),
"SQLInsertCompiler": Counter({"total": 3, "Provenance": 2, "Spatial": 1}),
"SQLUpdateCompiler": Counter({"total": 4, "Provenance": 4}),
"total": 8,
}