docstr: We can safely clear session refs and remove orphaned files
  from multiple threads simultaneously.
docstr_tok: ["We","can","safely","clear","session","refs","and","remove","orphaned","files","from","multiple","threads","simultaneously","."]
code: def test_clear_files_multiple_threads(self):
      """We can safely clear session refs and remove orphaned files
      from multiple threads simultaneously.
      """
      # Add a bunch of files
      for sample in ALL_FIXTURES.values():
          self.media_file_manager.add(
              sample["content"],
              sample["mimetype"],
              random_coordinates(),
          )
      self.assertEqual(
          len(ALL_FIXTURES), len(self.media_file_manager._file_metadata)
      )
  
      # Remove those files from multiple threads
      def remove_files(_: int) -> None:
          self.media_file_manager.clear_session_refs("mock_session_id")
          self.media_file_manager.remove_orphaned_files()
  
      call_on_threads(remove_files, num_threads=self.NUM_THREADS)
  
      # Our files should be gone!
      self.assertEqual(0, len(self.media_file_manager._file_metadata))
  
imports: import random
  import unittest
  from typing import Optional
  from unittest import TestCase, mock
  from unittest.mock import MagicMock, call, mock_open
  from streamlit.runtime.media_file_manager import MediaFileManager
  from streamlit.runtime.media_file_storage import MediaFileKind
  from streamlit.runtime.memory_media_file_storage import MemoryFile, MemoryMediaFileStorage, _calculate_file_id
  from tests.exception_capturing_thread import call_on_threads
label_desc: Use image node_id 3 for calling the MediaFileManagerThreadingTest obj's underlying member method code with example usage: obj.test_clear_files_multiple_threads() without return types