def test_datetime_to_timestamp_differentTimeZone(self):
     mst_dt = datetimeutil.GO_REFERENCE_TIME
     los_angeles_dt = datetimeutil.convert_timezone(
         mst_dt,
         self.los_angeles_time_zone,
     )
     self.assertEqual(
         datetimeutil.datetime_to_timestamp(mst_dt),
         datetimeutil.datetime_to_timestamp(los_angeles_dt),
     )
    def test_datetime_to_timestamp_pdtWorksFine(self):
        tz = self.los_angeles_time_zone
        three_am = self.pst_to_pdt_date.replace(hour=3)
        d = tz.normalize(tz.localize(three_am))

        self.assertEqual(
            1457863200,
            datetimeutil.datetime_to_timestamp(d),
        )
    def test_number_to_local_datetime_InSecs(self):
        d = datetimeutil.real_localize(
            datetime.datetime(2016, 3, 12),
            datetimeutil.LOCAL_TIMEZONE,
        )
        ts = datetimeutil.datetime_to_timestamp(d)

        guessed_dt, unit = datetimeutil.number_to_local_datetime(ts)
        self.assertEqual(d, guessed_dt)
        self.assertEqual("s", unit)