コード例 #1
0
ファイル: qstat.py プロジェクト: stdweird/vsc-jobs
    def test_normalise_time(self):
        """
        Test the conversion of a string [[[DD:]HH:]MM:]SS into seconds.
        """

        date_info1 = (1, 2, 3, 4)
        date1 = "%2d:%2s:%2d:%2d" % date_info1

        dates = [date1]
        date_infos = [date_info1]

        for d in zip(dates, date_infos):
            self.assertEqual(
                normalise_time(None, date1), sum([t * s for (t, s) in zip(date_info1, (24 * 60 * 60, 60 * 60, 60, 1))])
            )
コード例 #2
0
ファイル: qstat.py プロジェクト: JensTimmerman/vsc-jobs
    def test_normalise_time(self):
        """
        Test the conversion of a string [[[DD:]HH:]MM:]SS into seconds.
        """

        date_info1 = (1, 2, 3, 4)
        date1 = "%2d:%2s:%2d:%2d" % date_info1

        dates = [date1]
        date_infos = [date_info1]

        for d in zip(dates, date_infos):
            # pass non-existing named arg blablah to make sure that possible future argumnets do not cause failures
            self.assertEqual(
                normalise_time(job=None, time=date1, blablah='future argument'),
                sum([t*s for (t, s) in zip(date_info1, (24*60*60, 60*60, 60, 1))])
            )
コード例 #3
0
    def test_normalise_time(self):
        """
        Test the conversion of a string [[[DD:]HH:]MM:]SS into seconds.
        """

        date_info1 = (1, 2, 3, 4)
        date1 = "%2d:%2s:%2d:%2d" % date_info1

        dates = [date1]
        date_infos = [date_info1]

        for d in zip(dates, date_infos):
            # pass non-existing named arg blablah to make sure that possible future argumnets do not cause failures
            self.assertEqual(
                normalise_time(job=None, time=date1,
                               blablah='future argument'),
                sum([
                    t * s
                    for (t,
                         s) in zip(date_info1, (24 * 60 * 60, 60 * 60, 60, 1))
                ]))