          Category.objects.get(url='5th').delete()
          with self.assertRaises(ValidationError):
              f.clean(c5.id)
  
          f = forms.ModelChoiceField(Category.objects.filter(pk=c1.id), required=False)
          self.assertEqual(f.clean(''), None)
          f.clean('')
          self.assertEqual(f.clean(str(c1.id)).name, "Entertainment")
          with self.assertRaises(ValidationError):
              f.clean('100')
  
          # queryset can be changed after the field is created.
          f.queryset = Category.objects.exclude(name='Fourth')
 
</s> remove             f.clean(c5.id)
 </s> add             f.clean(c4.id) </s> remove         f.queryset = Category.objects.exclude(name='Fourth')
 </s> add         f.queryset = Category.objects.exclude(name='Third') </s> remove             f.clean([str(c3.id), '0'])
 </s> add             f.clean([str(self.c3.id), '0']) </s> remove             f.clean([str(c1.id), '0'])
 </s> add             f.clean([str(self.c1.id), '0']) </s> remove         f.queryset = Category.objects.exclude(name='Fourth')
 </s> add         f.queryset = Category.objects.exclude(name='Third')
    def test_modelchoicefield_choices(self):
        self.create_categories()
        f = forms.ModelChoiceField(Category.objects.filter(pk=self.c1.id), required=False)
        self.assertIsNone(f.clean(''))
        self.assertEqual(f.clean(str(self.c1.id)).name, "Entertainment")
          Category.objects.get(url='5th').delete()
          with self.assertRaises(ValidationError):
              f.clean(c5.id)
  
    def test_modelchoicefield_choices(self):
        self.create_categories()
        f = forms.ModelChoiceField(Category.objects.filter(pk=self.c1.id), required=False)
        self.assertIsNone(f.clean(''))
        self.assertEqual(f.clean(str(self.c1.id)).name, "Entertainment")
    def test_modelchoicefield_choices(self):
        self.create_categories()
        f = forms.ModelChoiceField(Category.objects.filter(pk=self.c1.id), required=False)
        self.assertIsNone(f.clean(''))
        self.assertEqual(f.clean(str(self.c1.id)).name, "Entertainment")
    def test_modelchoicefield_choices(self):
        self.create_categories()
        f = forms.ModelChoiceField(Category.objects.filter(pk=self.c1.id), required=False)
        self.assertIsNone(f.clean(''))
        self.assertEqual(f.clean(str(self.c1.id)).name, "Entertainment")
    def test_modelchoicefield_choices(self):
        self.create_categories()
        f = forms.ModelChoiceField(Category.objects.filter(pk=self.c1.id), required=False)
        self.assertIsNone(f.clean(''))
        self.assertEqual(f.clean(str(self.c1.id)).name, "Entertainment")
          with self.assertRaises(ValidationError):
              f.clean('100')
  
          # queryset can be changed after the field is created.
          f.queryset = Category.objects.exclude(name='Fourth')
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Fixed #6103 -- Splitted tests in model_forms tests 
tests/model_forms/tests.py