code: def test_watcher() -> None:
      with mocked_slurm() as mock:
          watcher = slurm.SlurmInfoWatcher()
          mock.set_job_state("12", "RUNNING")
          assert watcher.num_calls == 0
          state = watcher.get_state(job_id="11")
          assert set(watcher._info_dict.keys()) == {"12"}
          assert watcher._registered == {"11"}
  
          assert state == "UNKNOWN"
          mock.set_job_state("12", "FAILED")
          state = watcher.get_state(job_id="12", mode="force")
          assert state == "FAILED"
          # TODO: this test is implementation specific. Not sure if we can rewrite it another way.
          assert watcher._registered == {"11", "12"}
          assert watcher._finished == {"12"}
  
imports: import contextlib
  import os
  import signal
  import subprocess
  import typing
  from pathlib import Path
  from unittest.mock import patch
  import pytest
  import submitit
  from ..None import helpers
  from ..core import job_environment, submission, test_core, utils
  from ..core.core import Job
  from .None import slurm
label_desc: Use image node_id 23 for calling a global function with example usage: test_watcher() without return types