              self.assertEqual(translation.get_language(), 'fr')
  
      def test_explode(self):
          """ Test that an unknown command raises CommandError """
          self.assertRaises(CommandError, management.call_command, ('explode',))
  
      def test_system_exit(self):
          """ Exception raised in a command should raise CommandError with
              call_command, but SystemExit when run from command line
          """
 
</s> remove         self.assertRaises(
            DatabaseError,
            list,
            Person.objects.all().select_for_update(nowait=True)
        )
 </s> add         with self.assertRaises(DatabaseError):
            list(Person.objects.all().select_for_update(nowait=True)) </s> remove         self.assertRaises(ImproperlyConfigured, self.site.register, Location)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.site.register(Location) </s> remove         self.assertRaises(ImproperlyConfigured,
                          self.client.get,
                          '/syndication/articles/')
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.client.get('/syndication/articles/') </s> remove         self.assertRaises(ImportError, get_storage_class,
                          'django.core.files.storage.NonExistingStorage')
 </s> add         with self.assertRaises(ImportError):
            get_storage_class('django.core.files.storage.NonExistingStorage') </s> remove             self.assertRaises(BrokenException, self.client.get,
                reverse('view_exception', args=(n,)))
 </s> add             with self.assertRaises(BrokenException):
                self.client.get(reverse('view_exception', args=(n,)))
        with self.assertRaises(CommandError):
            management.call_command(('explode',))
              self.assertEqual(translation.get_language(), 'fr')
  
      def test_explode(self):
          """ Test that an unknown command raises CommandError """
        with self.assertRaises(CommandError):
            management.call_command(('explode',))
  
      def test_system_exit(self):
          """ Exception raised in a command should raise CommandError with
              call_command, but SystemExit when run from command line
          """
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/user_commands/tests.py