code: def test_pickle_figure_resampler_registered(
      registering_cleanup, pickle_figure
  ):
      nb_traces = 4
      nb_samples = 5_043
  
      register_plotly_resampler(
          mode="figure",
          default_n_shown_samples=50,
          show_dash_kwargs=dict(port=8051),
      )
  
      fig = go.Figure()
      for i in range(nb_traces):
          fig.add_trace(
              go.Scattergl(name=f"trace--{i}"),
              **_get_hf_props(nb_samples),
          )
      assert isinstance(fig, FigureResampler)
      assert not isinstance(fig, FigureWidgetResampler)
      assert fig._show_dash_kwargs["port"] == 8051
  
      pickle.dump(fig, open(pickle_figure, "wb"))
  
      # Loading with PR registered
      assert isinstance(go.Figure(), FigureResampler)
      fig_pickle = pickle.load(open(pickle_figure, "rb"))
      assert isinstance(fig_pickle, FigureResampler)
      assert fig_pickle._show_dash_kwargs["port"] == 8051
      assert len(fig_pickle.data) == nb_traces
      assert len(fig_pickle.hf_data) == nb_traces
      _check_correctly_serialized(fig_pickle, nb_traces, nb_samples)
  
      # Loading with PR registered as FigureWidgetResampler (& other nb default samples)
      register_plotly_resampler(
          mode="widget", default_n_shown_samples=75
      )
      assert isinstance(go.Figure(), FigureWidgetResampler)
      assert not isinstance(go.Figure(), FigureResampler)
      fig_pickle = pickle.load(open(pickle_figure, "rb"))
      assert isinstance(fig_pickle, FigureResampler)
      assert fig_pickle._show_dash_kwargs["port"] == 8051
      assert len(fig_pickle.data) == nb_traces
      assert len(fig_pickle.hf_data) == nb_traces
      _check_correctly_serialized(fig_pickle, nb_traces, nb_samples)
  
      # Loading with PR NOT registered
      unregister_plotly_resampler()
      assert not isinstance(go.Figure(), FigureWidgetResampler)
      assert not isinstance(go.Figure(), FigureResampler)
      fig_pickle = pickle.load(open(pickle_figure, "rb"))
      assert isinstance(fig_pickle, FigureResampler)
      assert fig_pickle._show_dash_kwargs["port"] == 8051
      assert len(fig_pickle.data) == nb_traces
      assert len(fig_pickle.hf_data) == nb_traces
      _check_correctly_serialized(fig_pickle, nb_traces, nb_samples)
  
      # Pickling and loading with PR NOT registered
      assert not isinstance(go.Figure(), FigureWidgetResampler)
      assert not isinstance(go.Figure(), FigureResampler)
      pickle.dump(fig, open(pickle_figure, "wb"))
      fig_pickle = pickle.load(open(pickle_figure, "rb"))
      assert isinstance(fig_pickle, FigureResampler)
      assert fig_pickle._show_dash_kwargs["port"] == 8051
      assert len(fig_pickle.data) == nb_traces
      assert len(fig_pickle.hf_data) == nb_traces
      _check_correctly_serialized(fig_pickle, nb_traces, nb_samples)
  
imports: from __future__ import annotations
  import copy
  import pickle
  import numpy
  import plotly.graph_objects
  from plotly.subplots import make_subplots
  from plotly_resampler import FigureResampler, FigureWidgetResampler
  from plotly_resampler.registering import register_plotly_resampler, unregister_plotly_resampler
  from .conftest import pickle_figure, registering_cleanup
label_desc: Use image node_id 5 for calling a global function with example usage: test_pickle_figure_resampler_registered(registering_cleanup, pickle_figure) without return types