Skip to content

Commit 726b66a

Browse files
committed
Explcitly check dimensions in slice tests
1 parent cee4975 commit 726b66a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/napari_matplotlib/tests/conftest.py

Lines 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

Lines 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy