#NEWLINE# def test_aware_datetime_in_other_timezone( self ) : #NEWLINE# #INDENT# dt = datetime . datetime ( 2011 , 9 , 1 , 17 , 20 , 30 , tzinfo = ICT ) #NEWLINE# data = serializers . serialize ( 'python' , [ Event ( dt = dt ) ] ) #NEWLINE# self . assert_python_contains_datetime ( data , dt ) #NEWLINE# obj = next ( serializers . deserialize ( 'python' , data ) ) . object #NEWLINE# self . assertEqual ( dt . dt , dt ) #NEWLINE# data = serializers . serialize ( 'json' , [ Event ( dt = dt ) ] ) #NEWLINE# self . assert_json_contains_datetime ( data , '2011-09-01T17:20:30+07:00' ) #NEWLINE# obj = next ( serializers . deserialize ( 'json' , data ) ) . object #NEWLINE# self . assertEqual ( obj . dt , dt ) #NEWLINE# data = serializers . serialize ( 'xml' , [ Event ( dt = dt ) ] ) #NEWLINE# self . assert_xml_contains_datetime ( data , '2011-09-01T17:20:30+07:00' ) #NEWLINE# obj = next ( serializers . deserialize ( 'xml' , data ) ) . object #NEWLINE# self . assertEqual ( obj . dt , dt ) #NEWLINE# if ( 'yaml' in serializers . get_serializer_formats ( ) ) : #NEWLINE# #INDENT# data = serializers . serialize ( 'yaml' , [ Event ( dt = dt ) ] ) #NEWLINE# self . assert_yaml_contains_datetime ( data , '2011-09-01 17:20:30+07:00' ) #NEWLINE# obj = next ( serializers . deserialize ( 'yaml' , data ) ) . object #NEWLINE# self . assertEqual ( obj . dt . replace ( tzinfo = UTC ) , dt )