code: def test_open_close_log_files():
      """We can open and close the log files."""
      frontend = PanelFrontend(_noop_render_fn)
      assert not frontend._log_files
      # When
      frontend._open_log_files()
      # Then
      stdout = frontend._log_files["stdout"]
      stderr = frontend._log_files["stderr"]
      assert not stdout.closed
      assert not stderr.closed
  
      # When
      frontend._close_log_files()
      # Then
      assert not frontend._log_files
      assert stdout.closed
      assert stderr.closed
  
      # We can close even if not open
      frontend._close_log_files()
  
imports: import os
  import runpy
  import sys
  from unittest import mock
  from unittest.mock import Mock
  import pytest
  from lightning.app import LightningFlow
  from lightning.app.frontend.panel import PanelFrontend, panel_serve_render_fn
  from lightning.app.frontend.panel.panel_frontend import _has_panel_autoreload
  from lightning.app.utilities.state import AppState
label_desc: Use image node_id 7 for calling a global function with example usage: test_open_close_log_files() without return types