code: def test_dirwatcher_finish_uploads_live_files_iff_changed(
      tempdir: Path,
      file_pusher: FilePusher,
      dir_watcher: DirWatcher,
      changed: bool,
  ):
      f = tempdir / "my-file.txt"
      write_with_mtime(f, b"content", mtime=0)
      dir_watcher.update_policy(str(f), "live")
      if changed:
          write_with_mtime(f, b"new content", mtime=1)
  
      file_pusher.file_changed.reset_mock()
      dir_watcher.finish()
      assert file_pusher.file_changed.called == changed
  
imports: import os
  import tempfile
  import time
  from pathlib import Path
  from typing import TYPE_CHECKING, Callable
  from unittest.mock import Mock, patch
  import pytest
  import wandb.filesync.dir_watcher
  from wandb.filesync.dir_watcher import DirWatcher, PolicyEnd, PolicyLive, PolicyNow
  from wandb.sdk.internal.file_pusher import FilePusher
label_desc: Use image node_id 11 for calling a global function with example usage: test_dirwatcher_finish_uploads_live_files_iff_changed(tempdir, file_pusher, dir_watcher, changed) without return types