'DateFields with manually specified input formats can accept those formats'

def test_dateField_with_inputformat(self):

    f = forms.DateField(input_formats=['%m.%d.%Y', '%m-%d-%Y'])
    with self.assertRaises(forms.ValidationError):
        f.clean('2010-12-21')
    with self.assertRaises(forms.ValidationError):
        f.clean('21/12/2010')
    with self.assertRaises(forms.ValidationError):
        f.clean('21.12.2010')
    result = f.clean('12.21.2010')
    self.assertEqual(result, date(2010, 12, 21))
    text = f.widget.format_value(result)
    self.assertEqual(text, '21.12.2010')
    result = f.clean('12-21-2010')
    self.assertEqual(result, date(2010, 12, 21))
    text = f.widget.format_value(result)
    self.assertEqual(text, '21.12.2010')
