def test_cast_hour_string_to_timestamp(self): today = datetime.date.today() self.assertEqual( cast_to_timestamp('10:', StringType(), options=BASE_OPTIONS), datetime.datetime(today.year, today.month, today.day, 10, 0, 0), )
def test_cast_longer_tz_string_to_timestamp(self): self.assertEqual( cast_to_timestamp('2019-10-01T05:40:36+03:', StringType(), options=BASE_OPTIONS), datetime.datetime(2019, 10, 1, 4, 40, 36), )
def test_cast_decimal_to_timestamp(self): self.assertEqual( cast_to_timestamp(147.58, DecimalType(), options=BASE_OPTIONS), datetime.datetime(1970, 1, 1, 1, 2, 27, 580000), )
def test_cast_int_to_timestamp(self): self.assertEqual( cast_to_timestamp(86400 * 365, IntegerType(), options=BASE_OPTIONS), datetime.datetime(1971, 1, 1, 1, 0, 0, 0), )
def test_cast_bool_to_timestamp(self): self.assertEqual( cast_to_timestamp(True, BooleanType(), options=BASE_OPTIONS), datetime.datetime(1970, 1, 1, 1, 0, 1, 0), )
def test_cast_date_string_to_timestamp(self): self.assertEqual( cast_to_timestamp('2019-10-01', StringType(), options=BASE_OPTIONS), datetime.datetime(2019, 10, 1, 0, 0, 0), )