django_assert_num_queries is helpful for this as well -- basically any time I'm writing a test for something where I've spent time thinking about query efficiency in the first place, I'll throw in an assert. (I actually use a homerolled version that can log the location of the queries with -v, but same idea.)