Skip to content

Commit

Permalink
test relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
nilomr committed May 20, 2022
1 parent 91f1849 commit f2be19e
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions tests/scratchpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def from_np_array(array_string):
np.fromstring(np_str, sep=" ")


#Test moving dataset location
# ──── TEST MOVING DATASET LOCATION ─────────────────────────────────────────────


DATASET_ID = "GREAT_TIT"
Expand All @@ -560,12 +560,31 @@ def from_np_array(array_string):


import shutil
move_to = out_dir.parents[1]/f'{out_dir.stem}_MOVED'

move_to = out_dir.parents[1] / f"{out_dir.stem}_MOVED"
shutil.move(out_dir.parent, move_to)

moved_dataset = move_to /f"{DATASET_ID}.db"
moved_dataset = move_to / f"{DATASET_ID}.db"
dataset = load_dataset(moved_dataset)

dataset.plot(dataset.vocs.index[0])

dataset.DIRS._deep_update_paths()
testpath = dataset.vocs["spectrogram_loc"][0]


def make_relpath(path: Path):
return path.relative_to(path.parents[3])


make_relpath(testpath)
dataset.vocs["spectrogram_loc"] = dataset.vocs["spectrogram_loc"].apply(
lambda x: make_relpath(x)
)


p = dataset.vocs["spectrogram_loc"][0].parts[0]

p.relative_to(p.parents[3])


dataset.DIRS._deep_update_paths(PROJECT, NEW_PROJECT)

0 comments on commit f2be19e

Please sign in to comment.