#NEWLINE# def test_dateTimeField_with_inputformat( self ) : #NEWLINE# #INDENT# 'DateTimeFields with manually specified input formats can accept those formats' #NEWLINE# f = forms . DateTimeField ( input_formats = [ '%H.%M.%S %m.%d.%Y' , '%H.%M %m-%d-%Y' ] ) #NEWLINE# self . assertRaises ( forms . ValidationError , f . clean , '2010-12-21 13:30:05 13:30:05' ) #NEWLINE# self . assertRaises ( forms . ValidationError , f . clean , '1:30:05 PM 21/12/2010' ) #NEWLINE# self . assertRaises ( forms . ValidationError , f . clean , '13:30:05 21.12.2010' ) #NEWLINE# result = f . clean ( '13.30.05 12.21.2010' ) #NEWLINE# self . assertEqual ( result , datetime ( 2010 , 12 , 21 , 13 , 30 , 5 ) ) #NEWLINE# text = f . widget . _format_value ( result ) #NEWLINE# self . assertEqual ( text , '21.12.2010 13:30:05' ) #NEWLINE# result = f . clean ( '13.30 12-21-2010' ) #NEWLINE# self . assertEqual ( result , datetime ( 2010 , 12 , 21 , 13 , 30 ) ) #NEWLINE# text = f . widget . _format_value ( result ) #NEWLINE# self . assertEqual ( text , '21.12.2010 13:30:00' )