Skip to content

Commit

Permalink
Fixed annotation import issue with changed structure (#900)
Browse files Browse the repository at this point in the history
  • Loading branch information
JBWilkie committed Aug 16, 2024
1 parent 7dd5540 commit 5c0cfff
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion darwin/importer/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ def _overwrite_warning(
"""
files_to_overwrite = []
for local_file in local_files:
item_id = remote_files.get(local_file.full_path)[0]
item_id = remote_files.get(local_file.full_path)["item_id"]
remote_annotations = client.api_v2._get_remote_annotations(
item_id,
dataset.team,
Expand Down
26 changes: 24 additions & 2 deletions tests/darwin/importer/importer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,18 @@ def test_overwrite_warning_proceeds_with_import():
remote_path="/",
),
]
remote_files = {"/file1": ("id1", "path1"), "/file2": ("id2", "path2")}
remote_files = {
"/file1": {
"item_id": "id1",
"slot_names": ["0"],
"layout": {"type": "simple", "version": 1, "slots": ["0"]},
},
"/file2": {
"item_id": "id2",
"slot_names": ["0"],
"layout": {"type": "simple", "version": 1, "slots": ["0"]},
},
}
console = MagicMock()

with patch("builtins.input", return_value="y"):
Expand Down Expand Up @@ -887,7 +898,18 @@ def test_overwrite_warning_aborts_import():
remote_path="/",
),
]
remote_files = {"/file1": ("id1", "path1"), "/file2": ("id2", "path2")}
remote_files = {
"/file1": {
"item_id": "id1",
"slot_names": ["0"],
"layout": {"type": "simple", "version": 1, "slots": ["0"]},
},
"/file2": {
"item_id": "id2",
"slot_names": ["0"],
"layout": {"type": "simple", "version": 1, "slots": ["0"]},
},
}
console = MagicMock()

with patch("builtins.input", return_value="n"):
Expand Down

0 comments on commit 5c0cfff

Please sign in to comment.