Skip to content

Glossary: Django Beyond the Basics

assertNumQueries

Also written: assertNumQueries(n)

A Django test assertion that fails unless the code in its `with` block runs exactly the given number of database queries. It stops N+1 problems from coming back.

Where the book teaches it

Related terms

N+1 problemselect_related