  
      @override_settings(SESSION_CACHE_ALIAS='sessions')
      def test_non_default_cache(self):
          # 21000 - CacheDB backend should respect SESSION_CACHE_ALIAS.
          self.assertRaises(InvalidCacheBackendError, self.backend)
  
  
  @override_settings(USE_TZ=True)
  class CacheDBSessionWithTimeZoneTests(CacheDBSessionTests):
      pass
 
</s> remove         self.assertRaises(ImproperlyConfigured, self.backend)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.backend() </s> remove         self.assertRaises(ValueError, NoModelModelForm)
 </s> add         with self.assertRaises(ValueError):
            NoModelModelForm() </s> remove         self.assertRaises(TypeError, GEOSGeometry, NotAGeometry())
 </s> add         with self.assertRaises(TypeError):
            GEOSGeometry(NotAGeometry()) </s> remove         self.assertRaises(SuspiciousOperation, self.storage.exists, '..')
        self.assertRaises(SuspiciousOperation, self.storage.exists, '/etc/passwd')
 </s> add         with self.assertRaises(SuspiciousOperation):
            self.storage.exists('..')
        with self.assertRaises(SuspiciousOperation):
            self.storage.exists('/etc/passwd') </s> remove         self.assertRaises(FieldError, list, qs)
        self.assertRaises(FieldError, list, qs)
 </s> add         with self.assertRaises(FieldError):
            list(qs)
        with self.assertRaises(FieldError):
            list(qs)
        with self.assertRaises(InvalidCacheBackendError):
            self.backend()
  
      @override_settings(SESSION_CACHE_ALIAS='sessions')
      def test_non_default_cache(self):
          # 21000 - CacheDB backend should respect SESSION_CACHE_ALIAS.
        with self.assertRaises(InvalidCacheBackendError):
            self.backend()
  
  
  @override_settings(USE_TZ=True)
  class CacheDBSessionWithTimeZoneTests(CacheDBSessionTests):
      pass
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/sessions_tests/tests.py