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_track_times():
""" Verify that track_times = False produces identical files """
hashes = []
for obj, filename, mode, kwargs in DUMP_CACHE:
if isinstance(filename, hickle.H5FileWrapper):
filename = str(filename.file_name)
kwargs['track_times'] = False
caching_dump(obj, filename, mode, **kwargs)
hashes.append(md5sum(filename))
os.remove(filename)
time.sleep(1)
for hash1, (obj, filename, mode, kwargs) in zip(hashes, DUMP_CACHE):
if isinstance(filename, hickle.H5FileWrapper):
filename = str(filename.file_name)
caching_dump(obj, filename, mode, **kwargs)
hash2 = md5sum(filename)
print(hash1, hash2)
try:
assert hash1 == hash2
os.remove(filename)
except AssertionError:
os.remove(filename)
raise
def test_track_times():
""" Verify that track_times = False produces identical files """
hashes = []
for obj, filename, mode, kwargs in DUMP_CACHE:
if isinstance(filename, hickle.H5FileWrapper):
filename = str(filename.file_name)
kwargs['track_times'] = False
caching_dump(obj, filename, mode, **kwargs)
hashes.append(md5sum(filename))
os.remove(filename)
time.sleep(1)
for hash1, (obj, filename, mode, kwargs) in zip(hashes, DUMP_CACHE):
if isinstance(filename, hickle.H5FileWrapper):
filename = str(filename.file_name)
caching_dump(obj, filename, mode, **kwargs)
hash2 = md5sum(filename)
print(hash1, hash2)
try:
assert hash1 == hash2
def test_track_times():
""" Verify that track_times = False produces identical files """
hashes = []
for obj, filename, mode, kwargs in DUMP_CACHE:
if isinstance(filename, hickle.H5FileWrapper):
filename = str(filename.file_name)
kwargs['track_times'] = False
caching_dump(obj, filename, mode, **kwargs)
hashes.append(md5sum(filename))
time.sleep(1)
for hash1, (obj, filename, mode, kwargs) in zip(hashes, DUMP_CACHE):
if isinstance(filename, hickle.H5FileWrapper):
filename = str(filename.file_name)
caching_dump(obj, filename, mode, **kwargs)
hash2 = md5sum(filename)
print(hash1, hash2)
assert hash1 == hash2
def test_track_times():
""" Verify that track_times = False produces identical files """
hashes = []
for obj, filename, mode, kwargs in DUMP_CACHE:
if isinstance(filename, hickle.H5FileWrapper):
filename = str(filename.file_name)
kwargs['track_times'] = False
caching_dump(obj, filename, mode, **kwargs)
hashes.append(md5sum(filename))
time.sleep(1)
for hash1, (obj, filename, mode, kwargs) in zip(hashes, DUMP_CACHE):
if isinstance(filename, hickle.H5FileWrapper):
filename = str(filename.file_name)
caching_dump(obj, filename, mode, **kwargs)
hash2 = md5sum(filename)
print(hash1, hash2)
assert hash1 == hash2