Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 726b66a

Browse filesBrowse files
committed
Explcitly check dimensions in slice tests
1 parent cee4975 commit 726b66a
Copy full SHA for 726b66a

File tree

Expand file treeCollapse file tree

2 files changed

+11
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-1
lines changed

‎src/napari_matplotlib/tests/conftest.py

Copy file name to clipboardExpand all lines: src/napari_matplotlib/tests/conftest.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import os
22
from pathlib import Path
3+
from typing import Any, Dict, Tuple
34

45
import numpy as np
6+
import numpy.typing as npt
57
import pytest
68
from skimage import data
79

@@ -18,7 +20,7 @@ def image_data(request):
1820

1921

2022
@pytest.fixture
21-
def astronaut_data():
23+
def astronaut_data() -> Tuple[npt.NDArray[Any], Dict[Any, Any]]:
2224
return data.astronaut(), {"rgb": True}
2325

2426

‎src/napari_matplotlib/tests/test_slice.py

Copy file name to clipboardExpand all lines: src/napari_matplotlib/tests/test_slice.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
def test_slice_3D(make_napari_viewer, brain_data):
1010
viewer = make_napari_viewer()
1111
viewer.theme = "light"
12+
13+
data = brain_data[0]
14+
assert data.ndim == 3
1215
viewer.add_image(brain_data[0], **brain_data[1])
16+
1317
axis = viewer.dims.last_used
1418
slice_no = brain_data[0].shape[0] - 1
1519
viewer.dims.set_current_step(axis, slice_no)
@@ -23,7 +27,11 @@ def test_slice_3D(make_napari_viewer, brain_data):
2327
def test_slice_2D(make_napari_viewer, astronaut_data):
2428
viewer = make_napari_viewer()
2529
viewer.theme = "light"
30+
31+
data = astronaut_data[0]
32+
assert data.ndim == 2
2633
viewer.add_image(astronaut_data[0], **astronaut_data[1])
34+
2735
fig = SliceWidget(viewer).figure
2836
# Need to return a copy, as original figure is too eagerley garbage
2937
# collected by the widget

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.