Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_initialize_string(self):
d = utils.DateTime('2015-03-07T17:47:44')
# ensure that timestamp is check with appropriate timezone offset
assert (1425750464+time.timezone) == d.timestamp
assert '2015-03-07 17:47:44' == '{}'.format(d)
def test_sub(self):
d2 = datetime.datetime(2015, 3, 7, 18, 18, 38, 508411)
ts2 = utils.DateTime(d2)
assert '0:30:53.791612' == '{}'.format(ts2 - self.datetime)
def test_factory(self):
new_time = utils.DateTime.now()
assert isinstance(new_time, utils.DateTime)
def test_factory(self):
new_time = utils.DateTime.now()
assert isinstance(new_time, utils.DateTime)
table = prettytable.PrettyTable(fields)
l = list_func()
offset = 0
while l:
offset += len(l)
for doc in l:
metadata_doc = doc['backup_metadata']
timestamp = int(metadata_doc.get('time_stamp', 0))
if args.long:
row = [doc['backup_uuid'],
metadata_doc.get('job_id', ''),
metadata_doc.get('client_id', ''),
metadata_doc.get('container', ''),
metadata_doc.get('hostname', ''),
metadata_doc.get('backup_name', ''),
str(freezer_utils.DateTime(timestamp)),
metadata_doc.get('curr_backup_level', ''),
metadata_doc.get('fs_real_path', '')]
else:
row = [doc['backup_uuid'],
metadata_doc.get('container', ''),
metadata_doc.get('backup_name', ''),
str(freezer_utils.DateTime(timestamp)),
metadata_doc.get('curr_backup_level', ''),
metadata_doc.get('fs_real_path', '')]
table.add_row(row)
l = list_func(offset=offset)
print(table)
def __sub__(self, other):
assert isinstance(other, DateTime)
return self.date_time - other.date_time # return timedelta
def now():
return DateTime(datetime.datetime.now())