diff --git a/simple_history/tests/tests/test_manager.py b/simple_history/tests/tests/test_manager.py index 30e5ec11..d86926d8 100644 --- a/simple_history/tests/tests/test_manager.py +++ b/simple_history/tests/tests/test_manager.py @@ -163,21 +163,24 @@ def test_historical_query_set(self): queryset = RankedDocument.history.filter(history_date__lte=t2) self.assertEqual(queryset.count(), 4) - # only want the most recend records (provided by HistoricalQuerySet) - self.assertEqual(queryset.latest_of_each().count(), 2) + # only want the most recent records (provided by HistoricalQuerySet) + with self.assertNumQueries(1): + self.assertEqual(queryset.latest_of_each().count(), 2) # want to see the instances as of that time? - self.assertEqual(queryset.latest_of_each().as_instances().count(), 1) + with self.assertNumQueries(1): + self.assertEqual(queryset.latest_of_each().as_instances().count(), 1) # these new methods are idempotent - self.assertEqual( - queryset.latest_of_each() - .latest_of_each() - .as_instances() - .as_instances() - .count(), - 1, - ) + with self.assertNumQueries(1): + self.assertEqual( + queryset.latest_of_each() + .latest_of_each() + .as_instances() + .as_instances() + .count(), + 1, + ) # that was all the same as calling as_of! self.assertEqual(