Пример #1
0
    def test_time(self):
        result = format_utils.format_timestamp(self.ARBITRARY_TIMESTAMP)
        result_gmt = format_utils.format_timestamp(self.ARBITRARY_TIMESTAMP,
                                                   gmt=True)

        self.assertEqual(result, '16:57:08.123456789')
        self.assertEqual(result_gmt, '20:57:08.123456789')
Пример #2
0
    def test_time(self):
        result = format_utils.format_timestamp(self.ARBITRARY_TIMESTAMP)
        result_gmt = format_utils.format_timestamp(
            self.ARBITRARY_TIMESTAMP, gmt=True
        )

        self.assertEqual(result, '16:57:08.123456789')
        self.assertEqual(result_gmt, '20:57:08.123456789')
Пример #3
0
    def test_date(self):
        result = format_utils.format_timestamp(self.ARBITRARY_TIMESTAMP,
                                               print_date=True)
        result_gmt = format_utils.format_timestamp(self.ARBITRARY_TIMESTAMP,
                                                   print_date=True,
                                                   gmt=True)

        self.assertEqual(result, '1991-08-25 16:57:08.123456789')
        self.assertEqual(result_gmt, '1991-08-25 20:57:08.123456789')
Пример #4
0
    def test_date(self):
        result = format_utils.format_timestamp(
            self.ARBITRARY_TIMESTAMP, print_date=True
        )
        result_gmt = format_utils.format_timestamp(
            self.ARBITRARY_TIMESTAMP, print_date=True, gmt=True
        )

        self.assertEqual(result, '1991-08-25 16:57:08.123456789')
        self.assertEqual(result_gmt, '1991-08-25 20:57:08.123456789')
Пример #5
0
    def test_negative(self):
        # Make sure the time module handles pre-epoch dates correctly
        result = format_utils.format_timestamp(-self.ARBITRARY_TIMESTAMP,
                                               print_date=True)
        result_gmt = format_utils.format_timestamp(-self.ARBITRARY_TIMESTAMP,
                                                   print_date=True,
                                                   gmt=True)

        self.assertEqual(result, '1948-05-08 23:02:51.876543211')
        self.assertEqual(result_gmt, '1948-05-09 03:02:51.876543211')
Пример #6
0
    def test_negative(self):
        # Make sure the time module handles pre-epoch dates correctly
        result = format_utils.format_timestamp(
            -self.ARBITRARY_TIMESTAMP, print_date=True
        )
        result_gmt = format_utils.format_timestamp(
            -self.ARBITRARY_TIMESTAMP, print_date=True, gmt=True
        )

        self.assertEqual(result, '1948-05-08 23:02:51.876543211')
        self.assertEqual(result_gmt, '1948-05-09 03:02:51.876543211')