                            self.backend()._key_to_file, "a\\b\\c")
  
      def test_invalid_key_forwardslash(self):
          # Ensure we don't allow directory-traversal
          self.assertRaises(InvalidSessionKey,
                            self.backend()._key_to_file, "a/b/c")
  
      @override_settings(
          SESSION_ENGINE="django.contrib.sessions.backends.file",
          SESSION_COOKIE_AGE=0,
      )
 
</s> remove         self.assertRaises(InvalidSessionKey,
                          self.backend()._key_to_file, "a\\b\\c")
 </s> add         with self.assertRaises(InvalidSessionKey):
            self.backend()._key_to_file("a\\b\\c") </s> remove         self.assertRaises(ImproperlyConfigured, self.backend)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.backend() </s> remove         self.assertRaises(ImproperlyConfigured, Sitemap().get_urls)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            Sitemap().get_urls() </s> remove         self.assertRaises(ImproperlyConfigured, Sitemap().get_urls)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            Sitemap().get_urls() </s> remove         self.assertRaises(ContentNotRenderedError,
                          pickle.dumps, response)
 </s> add         with self.assertRaises(ContentNotRenderedError):
            pickle.dumps(response)
        with self.assertRaises(InvalidSessionKey):
            self.backend()._key_to_file("a/b/c")
                            self.backend()._key_to_file, "a\\b\\c")
  
      def test_invalid_key_forwardslash(self):
          # Ensure we don't allow directory-traversal
        with self.assertRaises(InvalidSessionKey):
            self.backend()._key_to_file("a/b/c")
        with self.assertRaises(InvalidSessionKey):
            self.backend()._key_to_file("a/b/c")
  
      @override_settings(
          SESSION_ENGINE="django.contrib.sessions.backends.file",
          SESSION_COOKIE_AGE=0,
      )
keep keep keep keep replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/sessions_tests/tests.py