code: def test_metrics_is_ok_when_cpu_freq_throws(self):
      # psutil.cpu_freq() can throw NotImplementedError in certain environments;
      # make sure we don't crash when that occurs.
      with mock.patch.object(
          resources.psutil, "cpu_freq", side_effect=NotImplementedError
      ):
          with resources.ResourceMonitor() as monitor:
              self.assertEqual(monitor.metrics().cpu_frequency_mhz, 0)
  
file_path: deepvariant/deepvariant/resources_test.py
imports: import resource
  from unittest import mock
  from absl.testing import absltest
  import contextlib2
  from deepvariant import resources
label_desc: Use image node_id 7 for calling the ResourcesTest obj's underlying member method code with example usage: obj.test_metrics_is_ok_when_cpu_freq_throws() without return types