#NEWLINE# def test_convert_to_utc( self ) : #NEWLINE# #INDENT# date_without_tz = datetime . datetime . utcnow ( ) #NEWLINE# self . assertEqual ( date_without_tz . tzinfo , None ) #NEWLINE# result = date_utils . convert_to_utc ( date_without_tz ) #NEWLINE# self . assertEqual ( result . tzinfo . tzname ( None ) , 'UTC' ) #NEWLINE# date_with_pdt_tz = datetime . datetime ( 2015 , 10 , 28 , 10 , 0 , 0 , 0 ) #NEWLINE# date_with_pdt_tz = date_with_pdt_tz . replace ( tzinfo = pytz . timezone ( 'US/Pacific' ) ) #NEWLINE# self . assertEqual ( date_with_pdt_tz . tzinfo . tzname ( None ) , 'US/Pacific' ) #NEWLINE# result = date_utils . convert_to_utc ( date_with_pdt_tz ) #NEWLINE# self . assertEqual ( str ( result ) , '2015-10-28 17:53:00+00:00' ) #NEWLINE# self . assertEqual ( result . tzinfo . tzname ( None ) , 'UTC' )