def timestamp(self, time):
     if not time:
         return None
     # Must use `long` due to http://ironpython.codeplex.com/workitem/31549
     millis = long(round(timestamp_to_secs(time) * 1000))
     if self.basemillis is None:
         self.basemillis = millis
     return millis - self.basemillis
 def _get_data(self, statistics, errors, basemillis):
     gentime = time.localtime()
     return OrderedDict([('stats', statistics), ('errors', errors),
                         ('baseMillis', basemillis),
                         ('generatedMillis',
                          long(time.mktime(gentime) * 1000) - basemillis),
                         ('generatedTimestamp',
                          format_time(gentime, gmtsep=' '))])
Beispiel #3
0
 def timestamp(self, time):
     if not time:
         return None
     # Must use `long` due to http://ironpython.codeplex.com/workitem/31549
     millis = long(round(timestamp_to_secs(time) * 1000))
     if self.basemillis is None:
         self.basemillis = millis
     return millis - self.basemillis
 def test_base_types(self):
     for item, exp in [('bytes', 'string'), (u'unicode', 'string'),
                       (b'real bytes', 'string' if bytes is str else 'bytes'),
                       (bytearray(), 'bytearray'),
                       (1, 'integer'), (long(1), 'integer'), (1.0, 'float'),
                       (True, 'boolean'), (None, 'None'), (set(), 'set'),
                       ([], 'list'), ((), 'tuple'), ({}, 'dictionary')]:
         assert_equal(type_name(item), exp)
Beispiel #5
0
 def test_assert_equal_with_values_having_same_string_repr(self):
     for val, type_ in [(1, 'integer'), (long(1), 'integer'),
                        (MyEqual(1), 'MyEqual')]:
         assert_raises_with_msg(AE, '1 (string) != 1 (%s)' % type_,
                                assert_equal, '1', val)
     assert_raises_with_msg(AE, '1.0 (float) != 1.0 (string)', assert_equal,
                            1.0, u'1.0')
     assert_raises_with_msg(AE, 'True (string) != True (boolean)',
                            assert_equal, 'True', True)
Beispiel #6
0
 def write_data(self):
     generated_time = time.localtime()
     model = {
         'suite': JsonConverter(self._output_path).convert(self._suite),
         'title': self._title,
         'generated': format_time(generated_time, gmtsep=' '),
         'generatedMillis': long(time.mktime(generated_time) * 1000)
     }
     JsonWriter(self._output).write_json('testdoc = ', model)
Beispiel #7
0
 def write_data(self):
     generated_time = time.localtime()
     model = {
         'suite': JsonConverter(self._output_path).convert(self._suite),
         'title': self._title,
         'generated': format_time(generated_time, gmtsep=' '),
         'generatedMillis': long(time.mktime(generated_time) * 1000)
     }
     JsonWriter(self._output).write_json('testdoc = ', model)
 def _get_data(self, statistics, errors, basemillis):
     gentime = time.localtime()
     return {
         'stats': statistics,
         'errors': errors,
         'baseMillis': basemillis,
         'generatedMillis': long(time.mktime(gentime) * 1000) - basemillis,
         'generatedTimestamp': format_time(gentime, gmtsep=' ')
     }
 def _get_data(self, statistics, errors, basemillis):
     gentime = time.localtime()
     return {
         'stats': statistics,
         'errors': errors,
         'baseMillis': basemillis,
         'generatedMillis': long(time.mktime(gentime) * 1000) - basemillis,
         'generatedTimestamp': format_time(gentime, gmtsep=' ')
     }
Beispiel #10
0
 def test_assert_equal_with_values_having_same_string_repr(self):
     for val, type_ in [(1, 'integer'),
                        (long(1), 'integer'),
                        (MyEqual(1), 'MyEqual')]:
         assert_raises_with_msg(AE, '1 (string) != 1 (%s)' % type_,
                                assert_equal, '1', val)
     assert_raises_with_msg(AE, '1.0 (float) != 1.0 (string)',
                            assert_equal, 1.0, u'1.0')
     assert_raises_with_msg(AE, 'True (string) != True (boolean)',
                            assert_equal, 'True', True)
 def _get_data(self, statistics, errors, basemillis):
     gentime = time.localtime()
     return OrderedDict(
         [
             ("stats", statistics),
             ("errors", errors),
             ("baseMillis", basemillis),
             ("generatedMillis", long(time.mktime(gentime) * 1000) - basemillis),
             ("generatedTimestamp", format_time(gentime, gmtsep=" ")),
         ]
     )
 def test_base_types(self):
     for item, exp in [('bytes', 'string'), (u'unicode', 'string'),
                       (1, 'integer'), (long(1), 'integer'), (1.0, 'float'),
                       (True, 'boolean'), (None, 'None'), (set(), 'set'),
                       ([], 'list'), ((), 'tuple'), ({}, 'dictionary')]:
         assert_equals(type_name(item), exp)
 def test_dump_long(self):
     self._test(long(12345678901234567890), '12345678901234567890')
     self._test(long(0), '0')
 def test_dump_long(self):
     self._test(long(12345678901234567890), '12345678901234567890')
     self._test(long(0), '0')