def test_old_db_conversion(self): # prior 2.1, database only contained lengths (int as string) entries # check conversion is happening with NamedTemporaryFile(suffix='.npy', delete=False) as f: db = TrajectoryInfoCache(None) fn = f.name np.save(fn, [1, 2, 3]) f.close() # windows sucks reader = api.source(fn) hash = db._get_file_hash(fn) db._database = {hash: str(3)} info = db[fn, reader] assert info.length == 3 assert info.ndim == 1 assert info.offsets == []
def test_old_db_conversion(self): # prior 2.1, database only contained lengths (int as string) entries # check conversion is happening with NamedTemporaryFile(suffix='.npy', delete=False) as f: db = TrajectoryInfoCache(None) fn = f.name np.save(fn, [1, 2, 3]) f.close() # windows sucks reader = api.source(fn) hash = db._get_file_hash(fn) from pyemma.coordinates.data.util.traj_info_backends import DictDB db._database = DictDB() db._database.db_version = 0 info = db[fn, reader] assert info.length == 3 assert info.ndim == 1 assert info.offsets == []