def test_lookup_cache(self):
    '\n        Make sure that the content type cache (see ContentTypeManager)\n        works correctly. Lookups for a particular content type -- by model or\n        by ID -- should hit the database only on the first lookup.\n        '
    ContentType.objects.get_for_model(ContentType)
    self.assertEqual(1, len(db.connection.queries))
    ct = ContentType.objects.get_for_model(ContentType)
    self.assertEqual(1, len(db.connection.queries))
    ContentType.objects.get_for_id(ct.id)
    self.assertEqual(1, len(db.connection.queries))
    ContentType.objects.clear_cache()
    ContentType.objects.get_for_model(ContentType)
    len(db.connection.queries)
    self.assertEqual(2, len(db.connection.queries))
Make sure that the content type cache (see ContentTypeManager)
works correctly. Lookups for a particular content type -- by model or
by ID -- should hit the database only on the first lookup.
def test_lookup_cache(self):
    '\n        Make sure that the content type cache (see ContentTypeManager)\n        works correctly. Lookups for a particular content type -- by model or\n        by ID -- should hit the database only on the first lookup.\n        '
    ContentType.objects.get_for_model(ContentType)
    self.assertEqual(1, len(db.connection.queries))
    ct = ContentType.objects.get_for_model(ContentType)
    self.assertEqual(1, len(db.connection.queries))
    ContentType.objects.get_for_id(ct.id)
    self.assertEqual(1, len(db.connection.queries))
    ContentType.objects.clear_cache()
    ContentType.objects.get_for_model(ContentType)
    len(db.connection.queries)
    self.assertEqual(2, len(db.connection.queries))