Exemplo n.º 1
0
    def test_parsed(self):
        '''
        Test with a couple of timestamps from a real log
        '''
        with open('tests/fixtures/timestamps.txt', 'r') as stamps:
            for line in stamps:
                t = parse_utc_datetime(line.strip())
                t = round_to_minute(t)

                self.assertEqual(t.second, 0)
Exemplo n.º 2
0
    def test_round_to_minute(self):
        tests = (
            (
                datetime(2014, 1, 1, 11, 11, 11),
                datetime(2014, 1, 1, 11, 11, 0)
            ), (
                datetime(2014, 6, 18, 12, 25, 59),
                datetime(2014, 6, 18, 12, 25, 00),
            ), (
                datetime(1999, 6, 6, 12, 25, 00),
                datetime(1999, 6, 6, 12, 25, 00),
            )
        )

        for test, expected in tests:
            self.assertEqual(round_to_minute(test), expected)