  
          # An object without a file has limited functionality.
          obj1 = Storage()
          self.assertEqual(obj1.normal.name, "")
          self.assertRaises(ValueError, lambda: obj1.normal.size)
  
          # Saving a file enables full functionality.
          obj1.normal.save("django_test.txt", ContentFile("content"))
          self.assertEqual(obj1.normal.name, "tests/django_test.txt")
          self.assertEqual(obj1.normal.size, 7)
 
</s> remove         self.assertRaises(IOError, lambda: file_move_safe(self.file_a, self.file_b, allow_overwrite=False))
 </s> add         with self.assertRaises(IOError):
            file_move_safe(self.file_a, self.file_b, allow_overwrite=False) </s> remove             self.assertRaises(
                AttributeError,
                self.client.post,
                '/quota/broken/',
                {'f': file}
            )
 </s> add             with self.assertRaises(AttributeError):
                self.client.post('/quota/broken/', {'f': file}) </s> remove         self.assertRaises(ImproperlyConfigured, self.backend)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.backend() </s> remove         self.assertRaises(FieldError, Restaurant.objects.filter, supplier__name="foo")
 </s> add         with self.assertRaises(FieldError):
            Restaurant.objects.filter(supplier__name="foo") </s> remove             self.assertRaises(Director.DoesNotExist, lambda: private_school.director)
 </s> add             with self.assertRaises(Director.DoesNotExist):
                private_school.director
        with self.assertRaises(ValueError):
            obj1.normal.size
  
          # An object without a file has limited functionality.
          obj1 = Storage()
          self.assertEqual(obj1.normal.name, "")
        with self.assertRaises(ValueError):
            obj1.normal.size
  
          # Saving a file enables full functionality.
          obj1.normal.save("django_test.txt", ContentFile("content"))
          self.assertEqual(obj1.normal.name, "tests/django_test.txt")
          self.assertEqual(obj1.normal.size, 7)
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