          # instantiated. This proves clean() checks the database during clean() rather
          # than caching it at time of instantiation.
          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")
 
</s> remove         Category.objects.get(url='5th').delete()
 </s> add         Category.objects.get(url='4th').delete() </s> remove         c5 = Category.objects.create(name='Fifth', url='5th')
        self.assertEqual(c5.name, 'Fifth')
        self.assertEqual(f.clean(c5.id).name, 'Fifth')
 </s> add         c4 = Category.objects.create(name='Fourth', url='4th')
        self.assertEqual(f.clean(c4.id).name, 'Fourth') </s> remove         self.assertEqual(f.clean(c3.id).name, 'Third')
        self.assertEqual(f.clean(c2.id).name, "It's a test")
 </s> add         self.assertEqual(f.clean(self.c2.id).name, "It's a test")
        self.assertEqual(f.clean(self.c3.id).name, 'Third') </s> remove         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")
 </s> add     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") </s> remove         self.assertEqual(c6.name, 'Sixth')
 </s> add 
            f.clean(c4.id)
          # instantiated. This proves clean() checks the database during clean() rather
          # than caching it at time of instantiation.
          Category.objects.get(url='5th').delete()
          with self.assertRaises(ValidationError):
            f.clean(c4.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")
keep keep keep keep replace keep keep keep keep keep
 Fixed #6103 -- Splitted tests in model_forms tests 
tests/model_forms/tests.py