Skip to content

Commit b8f1e11

Browse files
committed
add tests for clim
1 parent 4640f07 commit b8f1e11

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/test_slicer.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ def test_slicer_init():
3333
assert isinstance(s.slider, dcc.Slider)
3434
assert isinstance(s.stores, list)
3535
assert all(isinstance(store, (dcc.Store, dcc.Interval)) for store in s.stores)
36+
for store in [s.clim, s.state, s.extra_traces, s.overlay_data]:
37+
assert isinstance(store, dcc.Store)
3638

3739

3840
def test_slicer_thumbnail():
39-
app = dash.Dash()
4041
vol = np.random.uniform(0, 255, (100, 100, 100)).astype(np.uint8)
4142

43+
app = dash.Dash()
4244
_ = VolumeSlicer(app, vol)
4345
# Test for name pattern of server-side callback when thumbnails are used
4446
assert any(["server-data.data" in key for key in app.callback_map])
@@ -49,6 +51,21 @@ def test_slicer_thumbnail():
4951
assert not any(["server-data.data" in key for key in app.callback_map])
5052

5153

54+
def test_clim():
55+
app = dash.Dash()
56+
vol = np.random.uniform(0, 255, (10, 10, 10)).astype(np.uint8)
57+
mi, ma = vol.min(), vol.max()
58+
59+
s = VolumeSlicer(app, vol)
60+
assert s._initial_clim == (mi, ma)
61+
62+
s = VolumeSlicer(app, vol, clim=None)
63+
assert s._initial_clim == (mi, ma)
64+
65+
s = VolumeSlicer(app, vol, clim=(10, 12))
66+
assert s._initial_clim == (10, 12)
67+
68+
5269
def test_scene_id_and_context_id():
5370
app = dash.Dash()
5471

0 commit comments

Comments
 (0)