#NEWLINE# @ skipIf ( ( pytz is None ) , 'this test requires pytz' ) #NEWLINE# def test_timezone_templatetag_with_pytz( self ) : #NEWLINE# #INDENT# '\n        Test the {% timezone %} templatetag with pytz.\n        ' #NEWLINE# tpl = Template ( '{% load tz %}{% timezone tz %}{{ dt }}{% endtimezone %}' ) #NEWLINE# ctx = Context ( { #NEWLINE# #INDENT# 'dt' : datetime . datetime ( 2011 , 9 , 1 , 13 , 20 , 30 , tzinfo = EAT ) , #NEWLINE# 'tz' : pytz . timezone ( 'Europe/Paris' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( tpl . render ( self ) , '2011-09-01T12:20:30+02:00' ) #NEWLINE# ctx = Context ( { #NEWLINE# #INDENT# 'dt' : datetime . datetime ( 2011 , 9 , 1 , 13 , 20 , 30 , tzinfo = EAT ) , #NEWLINE# 'tz' : 'Europe/Paris' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( tpl . render ( ctx ) , '2011-09-01T12:20:30+02:00' )