コード例 #1
0
    def test_datetime_to_excel_with_timezone_change(self):
        # test that the datetime is converted to the wanted timezone
        excel_value = 40910.0  # 2012, 1, 2, 0, 0
        dt = timezone('US/Eastern').localize(datetime.datetime(2012, 1, 2, 0, 0))
        dt = dt.astimezone(timezone('UTC'))

        render.set_export_timezone(timezone('US/Eastern'))
        # our datetime is now in UTC but we want the value in excel to be the US/Eastern equivalent
        self.assertEqual(render.datetime_to_excel_datetime(dt), excel_value)
コード例 #2
0
    def test_datetime_to_excel_with_timezone_change(self):
        # test that the datetime is converted to the wanted timezone
        excel_value = 40910.0  # 2012, 1, 2, 0, 0
        dt = timezone('US/Eastern').localize(
            datetime.datetime(2012, 1, 2, 0, 0))
        dt = dt.astimezone(timezone('UTC'))

        render.set_export_timezone(timezone('US/Eastern'))
        # our datetime is now in UTC but we want the value in excel to be the US/Eastern equivalent
        self.assertEqual(render.datetime_to_excel_datetime(dt), excel_value)
コード例 #3
0
 def tearDown(self):
     render.set_export_timezone(timezone('UTC'))
     super().tearDown()
コード例 #4
0
 def test_set_timezone(self):
     render.set_export_timezone(timezone('US/Eastern'))
     self.assertEqual(render.get_export_timezone(), timezone('US/Eastern'))
コード例 #5
0
 def tearDown(self):
     render.set_export_timezone(timezone('UTC'))
     super(TestDatetime, self).tearDown()
コード例 #6
0
 def test_set_timezone(self):
     render.set_export_timezone(timezone('US/Eastern'))
     self.assertEqual(render.get_export_timezone(), timezone('US/Eastern'))
コード例 #7
0
 def tearDown(self):
     render.set_export_timezone(timezone('UTC'))
     super(TestDatetime, self).tearDown()