code: def test(mock_save: MagicMock, mock_abspath: MagicMock):
      controller = Mock()
      mock_save.return_value = "savepath"
  
      s = State()
      s.output_file("foo.html")
  
      bis._show_file_with_state("obj", s, "window", controller)
  
      assert mock_save.call_count == 1
      assert mock_save.call_args[0] == ("obj",)
      assert mock_save.call_args[1] == {"state": s}
  
      assert controller.open.call_count == 1
      assert controller.open.call_args[0] == ("file://savepath",)
      assert controller.open.call_args[1] == {"new": 1}
  
      bis._show_file_with_state("obj", s, "tab", controller)
  
      assert mock_save.call_count == 2
      assert mock_save.call_args[0] == ("obj",)
      assert mock_save.call_args[1] == {"state": s}
  
      assert controller.open.call_count == 2
      assert controller.open.call_args[0] == ("file://savepath",)
      assert controller.open.call_args[1] == {"new": 2}
  
file_path: bokeh/tests/unit/bokeh/io/test_showing.py
imports: from __future__ import annotations
  import pytest
  from unittest.mock import MagicMock, Mock, patch
  from bokeh.application.application import Application
  from bokeh.io.doc import curdoc
  from bokeh.io.output import output_notebook
  from bokeh.io.state import State, curstate
  from bokeh.models import ColumnDataSource, GlyphRenderer, Plot
  import bokeh.io.showing
label_desc: Use image node_id 8 for calling a global function with example usage: test(mock_save, mock_abspath) without return types