Skip to content

Commit 4e11b7b

Browse files
Fix test assertions to match improved error messages
Co-authored-by: CodyCBakerPhD <51133164+CodyCBakerPhD@users.noreply.github.com>
1 parent f969d78 commit 4e11b7b

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

dandi/tests/test_move.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,14 @@ def test_move_nonexistent_src(
374374
work_on=work_on,
375375
dandi_instance=moving_dandiset.api.instance_id,
376376
)
377-
assert (
378-
str(excinfo.value)
379-
== f"No asset at {'remote' if work_on == 'remote' else 'local'} path 'subdir1/avocado.txt'"
377+
assert str(excinfo.value) == (
378+
f"No asset at {'remote' if work_on == MoveWorkOn.REMOTE else 'local'} path 'subdir1/avocado.txt'. "
379+
+ (
380+
"Verify the path is correct and the asset exists on the server. "
381+
"Use 'dandi ls' to list available assets."
382+
if work_on == MoveWorkOn.REMOTE
383+
else "Verify the path is correct and the file exists locally."
384+
)
380385
)
381386
check_assets(moving_dandiset, starting_assets, work_on, {})
382387

@@ -402,7 +407,8 @@ def test_move_file_slash_src(
402407
)
403408
assert (
404409
str(excinfo.value)
405-
== f"{'Remote' if work_on == 'remote' else 'Local'} path 'subdir1/apple.txt/' is a file"
410+
== f"{'Remote' if work_on == MoveWorkOn.REMOTE else 'Local'} path 'subdir1/apple.txt/' is a file but a directory was expected. "
411+
"Use a path ending with '/' for directories."
406412
)
407413
check_assets(moving_dandiset, starting_assets, work_on, {})
408414

@@ -427,7 +433,8 @@ def test_move_file_slash_dest(
427433
)
428434
assert (
429435
str(excinfo.value)
430-
== f"{'Remote' if work_on == 'remote' else 'Local'} path 'subdir1/apple.txt/' is a file"
436+
== f"{'Remote' if work_on == MoveWorkOn.REMOTE else 'Local'} path 'subdir1/apple.txt/' is a file but a directory was expected. "
437+
"Use a path ending with '/' for directories."
431438
)
432439
check_assets(moving_dandiset, starting_assets, work_on, {})
433440

@@ -593,9 +600,14 @@ def test_move_from_subdir_abspaths(
593600
work_on=work_on,
594601
dandi_instance=moving_dandiset.api.instance_id,
595602
)
596-
assert (
597-
str(excinfo.value)
598-
== f"No asset at {'remote' if work_on == 'remote' else 'local'} path 'file.txt'"
603+
assert str(excinfo.value) == (
604+
f"No asset at {'remote' if work_on == MoveWorkOn.REMOTE else 'local'} path 'file.txt'. "
605+
+ (
606+
"Verify the path is correct and the asset exists on the server. "
607+
"Use 'dandi ls' to list available assets."
608+
if work_on == MoveWorkOn.REMOTE
609+
else "Verify the path is correct and the file exists locally."
610+
)
599611
)
600612
check_assets(moving_dandiset, starting_assets, work_on, {})
601613

@@ -619,7 +631,11 @@ def test_move_from_subdir_as_dot(
619631
dandi_instance=moving_dandiset.api.instance_id,
620632
devel_debug=True,
621633
)
622-
assert str(excinfo.value) == "Cannot move current working directory"
634+
assert (
635+
str(excinfo.value)
636+
== "Cannot move current working directory. "
637+
"Change to a different directory before moving this location."
638+
)
623639
check_assets(moving_dandiset, starting_assets, work_on, {})
624640

625641

0 commit comments

Comments
 (0)