@skipIf(pytz is None, "this test requires pytz")
    def test_timezone_templatetag_with_pytz(self):
        tpl = Template("{% load tz %}{% timezone tz %}{{ dt }}{% endtimezone %}")

        # Use a pytz timezone as argument
        ctx = Context({'dt': datetime.datetime(2011, 9, 1, 13, 20, 30, tzinfo=EAT),
                       'tz': pytz.timezone('Europe/Paris')})
        self.assertEqual(tpl.render(ctx), "2011-09-01T12:20:30+02:00")

        # Use a pytz timezone name as argument
        ctx = Context({'dt': datetime.datetime(2011, 9, 1, 13, 20, 30, tzinfo=EAT),
                       'tz': 'Europe/Paris'})
        self.assertEqual(tpl.render(ctx), "2011-09-01T12:20:30+02:00")
Test the {% timezone %} templatetag with pytz.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/tests/modeltests/timezones/tests.py/TemplateTests.test_timezone_templatetag_with_pytz