          self.assertEqual(self.storage.url("""a/b\\c.file"""),
              """/test_media_url/a/b/c.file""")
  
          self.storage.base_url = None
          self.assertRaises(ValueError, self.storage.url, 'test.file')
  
          # #22717: missing ending slash in base_url should be auto-corrected
          storage = self.storage_class(location=self.temp_dir,
              base_url='/no_ending_slash')
          self.assertEqual(
 
</s> remove         self.assertRaises(ValidationError, form_field.clean, '127.0.0.1')
 </s> add         with self.assertRaises(ValidationError):
            form_field.clean('127.0.0.1') </s> remove         self.assertRaises(Http404, get_object_or_404, Article, title="Foo")
 </s> add         with self.assertRaises(Http404):
            get_object_or_404(Article, title="Foo") </s> remove         self.assertRaises(ValueError, setattr, p, 'restaurant', None)
 </s> add         with self.assertRaises(ValueError):
            setattr(p, 'restaurant', None) </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(ValueError, setattr, p, 'restaurant', p)
 </s> add         with self.assertRaises(ValueError):
            setattr(p, 'restaurant', p)
        with self.assertRaises(ValueError):
            self.storage.url('test.file')
          self.assertEqual(self.storage.url("""a/b\\c.file"""),
              """/test_media_url/a/b/c.file""")
  
          self.storage.base_url = None
        with self.assertRaises(ValueError):
            self.storage.url('test.file')
  
          # #22717: missing ending slash in base_url should be auto-corrected
          storage = self.storage_class(location=self.temp_dir,
              base_url='/no_ending_slash')
          self.assertEqual(
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/file_storage/tests.py