Skip to content

Commit 0ba59cb

Browse files
committed
🤖 add manual test
1 parent 4a59370 commit 0ba59cb

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/test_figure_resampler.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,39 @@ def test_stop_server_inline_persistent():
629629
proc.terminate()
630630

631631

632+
def test_manual_jupyterdashpersistentinline():
633+
# Manually call the JupyterDashPersistentInline its method
634+
# This requires some gimmicky stuff to mimmick the behaviour of a jupyter notebook.
635+
636+
fr = FigureResampler(go.Figure())
637+
n = 100_000
638+
x = np.arange(n)
639+
y = np.sin(x)
640+
fr.add_trace(go.Scattergl(name="test"), hf_x=x, hf_y=y)
641+
642+
# no need to start the app (we just need the FigureResampler object)
643+
644+
from plotly_resampler.figure_resampler.figure_resampler import JupyterDashPersistentInlineOutput
645+
import dash
646+
app = JupyterDashPersistentInlineOutput("manual_app")
647+
assert hasattr(app, "_uid")
648+
649+
# Mimmick what happens in the .show_dash method
650+
# note: this is necessary because the figure gets accessed in the J
651+
# JupyterDashPersistentInline its _display_inline_output method (to create the img)
652+
app.layout = dash.html.Div(
653+
[
654+
dash.dcc.Graph(
655+
id="resample-figure", figure=fr
656+
),
657+
# no need to add traceupdater for this dummy app
658+
]
659+
)
660+
661+
# call the method
662+
app._display_in_jupyter(f"", port="", mode="inline", width='100%', height=500)
663+
664+
632665
def test_stop_server_external():
633666
fr = FigureResampler(go.Figure())
634667
n = 100_000

0 commit comments

Comments
 (0)