code: def test_default_filename() -> None:
      old_detect_current_filename = biu.detect_current_filename
      old__no_access = biu._no_access
      old__shares_exec_prefix = biu._shares_exec_prefix
  
      biu.detect_current_filename = lambda: "/a/b/foo.py"
  
      try:
          # .py extension
          with pytest.raises(RuntimeError):
              biu.default_filename("py")
  
          def FALSE(_: str) -> bool:
              return False
  
          def TRUE(_: str) -> bool:
              return True
  
          # a current file, access, and no share exec
          biu._no_access = FALSE
          r = biu.default_filename("test")
          assert os.path.normpath(r) == os.path.normpath(
              "/a/b/foo.test"
          )
  
          # a current file, NO access, and no share exec
          biu._no_access = TRUE
          r = biu.default_filename("test")
          assert os.path.normpath(r) != os.path.normpath(
              "/a/b/foo.test"
          )
          assert r.endswith(".test")
  
          # a current file, access, but WITH share exec
          biu._no_access = FALSE
          biu._shares_exec_prefix = TRUE
          r = biu.default_filename("test")
          assert os.path.normpath(r) != os.path.normpath(
              "/a/b/foo.test"
          )
          assert r.endswith(".test")
  
          # no current file
          biu.detect_current_filename = lambda: None
          biu._no_access = FALSE
          biu._shares_exec_prefix = FALSE
          r = biu.default_filename("test")
          assert os.path.normpath(r) != os.path.normpath(
              "/a/b/foo.test"
          )
          assert r.endswith(".test")
  
      finally:
          biu.detect_current_filename = old_detect_current_filename
          biu._no_access = old__no_access
          biu._shares_exec_prefix = old__shares_exec_prefix
  
file_path: bokeh/tests/unit/bokeh/io/test_util__io.py
imports: from __future__ import annotations
  import pytest
  import os
  from unittest.mock import MagicMock, patch
  import bokeh.io.util
label_desc: Use image node_id 3 for calling a global function with example usage: test_default_filename() and returns: False, True