                           [(id_field, {}), (name_field, {'widget': widget})])
  
      def test_bad_callback(self):
          # A bad callback provided by user still gives an error
          self.assertRaises(TypeError, modelform_factory, Person, fields="__all__",
                            formfield_callback='not a function or callable')
  
  
  class LocalizedModelFormTest(TestCase):
      def test_model_form_applies_localize_to_some_fields(self):
          class PartiallyLocalizedTripleForm(forms.ModelForm):
 
</s> remove         self.assertRaises(FieldError, modelform_factory,
                          Person, fields=['no-field', 'name'])
 </s> add         with self.assertRaises(FieldError):
            modelform_factory(Person, fields=['no-field', 'name']) </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(TypeError, build_no_cbc)
 </s> add         with self.assertRaises(TypeError):
            build_no_cbc() </s> remove         self.assertRaises(TypeError, build_no_base_classes)
 </s> add         with self.assertRaises(TypeError):
            build_no_base_classes() </s> remove         self.assertRaises(TypeError, build_abc)
 </s> add         with self.assertRaises(TypeError):
            build_abc()
        with self.assertRaises(TypeError):
            modelform_factory(Person, fields="__all__", formfield_callback='not a function or callable')
                           [(id_field, {}), (name_field, {'widget': widget})])
  
      def test_bad_callback(self):
          # A bad callback provided by user still gives an error
        with self.assertRaises(TypeError):
            modelform_factory(Person, fields="__all__", formfield_callback='not a function or callable')
        with self.assertRaises(TypeError):
            modelform_factory(Person, fields="__all__", formfield_callback='not a function or callable')
  
  
  class LocalizedModelFormTest(TestCase):
      def test_model_form_applies_localize_to_some_fields(self):
          class PartiallyLocalizedTripleForm(forms.ModelForm):
keep keep keep keep replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/model_forms/tests.py