              file.write(b'a' * (2 ** 21))
              file.seek(0)
  
              # AttributeError: You cannot alter upload handlers after the upload has been processed.
              self.assertRaises(
                  AttributeError,
                  self.client.post,
                  '/quota/broken/',
                  {'f': file}
              )
  
      def test_fileupload_getlist(self):
          file = tempfile.NamedTemporaryFile
          with file() as file1, file() as file2, file() as file2a:
              file1.write(b'a' * (2 ** 23))
 
</s> remove         self.assertRaises(AttributeError, lambda: CommonInfo.objects.all())
 </s> add         with self.assertRaises(AttributeError):
            CommonInfo.objects.all() </s> remove         self.assertRaises(ImproperlyConfigured, self.backend)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.backend() </s> remove         self.assertRaises(
            Place.MultipleObjectsReturned,
            Restaurant.objects.get, id__lt=12321
        )
 </s> add         with self.assertRaises(Place.MultipleObjectsReturned):
            Restaurant.objects.get(id__lt=12321) </s> remove         self.assertRaises(IntegrityError, Tag.objects.create, title="bar", slug="foo")
 </s> add         with self.assertRaises(IntegrityError):
            Tag.objects.create(title="bar", slug="foo") </s> remove         self.assertRaises(
            DatabaseError,
            lambda: list(Author.objects.all()),
        )
 </s> add         with self.assertRaises(DatabaseError):
            list(Author.objects.all())
            with self.assertRaises(AttributeError):
                self.client.post('/quota/broken/', {'f': file})
              file.write(b'a' * (2 ** 21))
              file.seek(0)
  
              # AttributeError: You cannot alter upload handlers after the upload has been processed.
            with self.assertRaises(AttributeError):
                self.client.post('/quota/broken/', {'f': file})
            with self.assertRaises(AttributeError):
                self.client.post('/quota/broken/', {'f': file})
            with self.assertRaises(AttributeError):
                self.client.post('/quota/broken/', {'f': file})
            with self.assertRaises(AttributeError):
                self.client.post('/quota/broken/', {'f': file})
            with self.assertRaises(AttributeError):
                self.client.post('/quota/broken/', {'f': file})
            with self.assertRaises(AttributeError):
                self.client.post('/quota/broken/', {'f': file})
  
      def test_fileupload_getlist(self):
          file = tempfile.NamedTemporaryFile
          with file() as file1, file() as file2, file() as file2a:
              file1.write(b'a' * (2 ** 23))
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/file_uploads/tests.py