Skip to content

Commit b67be6c

Browse files
committed
Test multiple data shapes
1 parent 3fd5359 commit b67be6c

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

Diff for: src/napari_matplotlib/tests/conftest.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import numpy as np
2+
import pytest
3+
4+
5+
@pytest.fixture(
6+
params=[
7+
((100, 100), {"rgb": False}),
8+
((100, 100, 100), {"rgb": False}),
9+
((100, 100, 3), {"rgb": True}),
10+
]
11+
)
12+
def image_data(request):
13+
return np.ones(request.param[0]), request.param[1]

Diff for: src/napari_matplotlib/tests/test_histogram.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
import numpy as np
2-
import pytest
3-
41
from napari_matplotlib import HistogramWidget
52

63

7-
# Test with 2D and 3D data
8-
@pytest.mark.parametrize(
9-
"data", [np.random.random((100, 100)), np.random.random((100, 100, 100))]
10-
)
11-
def test_example_q_widget(make_napari_viewer, data):
4+
def test_example_q_widget(make_napari_viewer, image_data):
125
# Smoke test adding a histogram widget
136
viewer = make_napari_viewer()
14-
viewer.add_image(data)
7+
viewer.add_image(image_data[0], **image_data[1])
158
HistogramWidget(viewer)

0 commit comments

Comments
 (0)