Пример #1
0
    def test_parse_ts(self):
        ts = '2014-02-08T12:00:00Z'
        expected = 1391832000.0
        self.assertEqual(parse_ts(ts), expected)

        ts = '2014-02-08T12:00:00.000Z'
        expected = 1391832000.0
        self.assertEqual(parse_ts(ts), expected)
Пример #2
0
    def test_parse_ts(self):
        ts = '2014-02-08T12:00:00Z'
        expected = 1391832000.0 + time.timezone + 60 * 60 * 8
        self.assertEqual(parse_ts(ts), expected)

        ts = '2014-02-08T12:00:00.000Z'
        expected = 1391832000.0 + time.timezone + 60 * 60 * 8
        self.assertEqual(parse_ts(ts), expected)
Пример #3
0
    def test_parse_ts(self):
        ts = '2014-02-08T12:00:00Z'
        expected = 1391832000.0
        self.assertEqual(parse_ts(ts), expected)

        ts = '2014-02-08T12:00:00.000Z'
        expected = 1391832000.0
        self.assertEqual(parse_ts(ts), expected)
 def check_datetime_params(self, directive, params):
     """ Specified params should be `date` type if in directive
     @param directive: the directive to check
     @param params: the params that should be `date` type.
     """
     for param in params:
         if param not in directive:
             continue
         if not parse_ts(directive[param]):
             self.err_occur("[%s] should be 'YYYY-MM-DDThh:mm:ssZ' in directive [%s]" % (param, directive))
Пример #5
0
 def check_datetime_params(self, directive, params):
     """ Specified params should be `date` type if in directive
     @param directive: the directive to check
     @param params: the params that should be `date` type.
     """
     for param in params:
         if param not in directive:
             continue
         if not parse_ts(directive[param]):
             self.err_occur(
                 "[%s] should be 'YYYY-MM-DDThh:mm:ssZ' in directive [%s]" %
                 (param, directive))