Skip to content

Commit f6b6893

Browse files
committed
test: fix testing netCDF bbox type file loading from dataset
1 parent 7dd464d commit f6b6893

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

movement/napari/loader_widgets.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ def __init__(self, napari_viewer: Viewer, parent=None):
6969
self._create_load_button()
7070

7171
# FPS box state
72-
self.source_software_combo.currentTextChanged.connect(
73-
self._on_source_software_changed
74-
)
72+
# self.source_software_combo.currentTextChanged.connect(
73+
# self._on_source_software_changed
74+
# )
7575
# To set initial state of the FPS box
7676
self._on_source_software_changed(
7777
self.source_software_combo.currentText()
@@ -111,12 +111,17 @@ def _create_fps_widget(self):
111111
# How much we increment/decrement when the user clicks the arrows
112112
self.fps_spinbox.setSingleStep(1)
113113
# Add a tooltip
114-
self.fps_spinbox.setToolTip(
114+
self.fps_default_tooltip = (
115115
"Set the frames per second of the tracking data.\n"
116116
"This just affects the displayed time when hovering over a point\n"
117117
"(it doesn't set the playback speed)."
118118
)
119-
self.fps_default_tooltip = self.fps_spinbox.toolTip()
119+
# self.fps_default_tooltip = self.fps_spinbox.toolTip()
120+
self.fps_spinbox.setToolTip(self.fps_default_tooltip)
121+
# Connect fps spinbox with _on_source_software_changed
122+
self.source_software_combo.currentTextChanged.connect(
123+
self._on_source_software_changed,
124+
)
120125
self.layout().addRow("fps:", self.fps_spinbox)
121126

122127
def _create_file_path_widget(self):

tests/test_unit/test_napari_plugin/test_data_loader_widget.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,54 +256,63 @@ def test_on_load_clicked_without_file_path(make_napari_viewer_proxy, capsys):
256256

257257

258258
@pytest.mark.parametrize(
259-
"filename, source_software, tracks_array_shape",
259+
"filename, source_software, tracks_array_shape, is_bbox",
260260
[
261261
(
262262
"VIA_single-crab_MOCA-crab-1.csv",
263263
"VIA-tracks",
264264
(35, 4),
265+
True,
265266
), # single individual, no keypoints (bboxes)
266267
(
267268
"VIA_multiple-crabs_5-frames_labels.csv",
268269
"VIA-tracks",
269270
(430, 4),
271+
True,
270272
), # multiple individuals, no keypoints (bboxes)
271273
(
272274
"SLEAP_single-mouse_EPM.predictions.slp",
273275
"SLEAP",
274276
(110910, 4),
277+
False,
275278
), # single individual, multiple keypoints
276279
(
277280
"DLC_single-wasp.predictions.h5",
278281
"DeepLabCut",
279282
(2170, 4),
283+
False,
280284
), # single individual, multiple keypoints
281285
(
282286
"DLC_two-mice.predictions.csv",
283287
"DeepLabCut",
284288
(1439976, 4),
289+
False,
285290
), # two individuals, multiple keypoints
286291
(
287292
"SLEAP_three-mice_Aeon_mixed-labels.analysis.h5",
288293
"SLEAP",
289294
(1803, 4),
295+
False,
290296
), # three individuals, one keypoint
291297
(
292298
"MOVE_two-mice_octagon.analysis.nc",
293299
"movement (netCDF)",
294300
(126000, 4),
301+
False,
295302
),
296303
(
297304
"MOVE_single-crab_MOCA-crab-1_linear-interp.nc",
298305
"movement (netCDF)",
299-
(0, 0),
306+
(168, 4),
307+
True,
300308
),
301309
],
302310
)
303311
def test_on_load_clicked_with_valid_file_path(
304312
filename,
305313
source_software,
306314
tracks_array_shape,
315+
is_bbox,
307316
make_napari_viewer_proxy,
308317
caplog,
309318
):
@@ -342,7 +351,8 @@ def test_on_load_clicked_with_valid_file_path(
342351
assert data_loader_widget.data is not None
343352
assert data_loader_widget.properties is not None
344353
assert data_loader_widget.data_not_nan is not None
345-
if source_software in SUPPORTED_BBOXES_FILES:
354+
# if source_software in SUPPORTED_BBOXES_FILES:
355+
if is_bbox:
346356
assert data_loader_widget.data_bboxes is not None
347357
else:
348358
# Only bounding boxes datasets should add bboxes data
@@ -379,7 +389,8 @@ def test_on_load_clicked_with_valid_file_path(
379389
"Added tracked dataset as a napari Points layer.",
380390
"Added tracked dataset as a napari Tracks layer.",
381391
}
382-
if source_software in SUPPORTED_BBOXES_FILES:
392+
# if source_software in SUPPORTED_BBOXES_FILES:
393+
if is_bbox:
383394
expected_log_messages.add(
384395
"Added tracked dataset as a napari Shapes layer."
385396
)

0 commit comments

Comments
 (0)