code: def testResolveWithDeviceScope(self):
      with ops.device("/gpu:0"):
          self.assertEqual(
              device_util.resolve("/job:worker/task:1/cpu:0"),
              "/job:worker/replica:0/task:1/device:CPU:0",
          )
          self.assertEqual(
              device_util.resolve("/job:worker/task:1"),
              "/job:worker/replica:0/task:1/device:GPU:0",
          )
      with ops.device("/job:worker"):
          self.assertEqual(
              device_util.resolve("/cpu:0"),
              "/job:worker/replica:0/task:0/device:CPU:0",
          )
  
file_path: tensorflow-upstream/tensorflow/python/distribute/device_util_test.py
imports: from absl.testing import parameterized
  from tensorflow.core.protobuf import tensorflow_server_pb2
  from tensorflow.python.distribute import combinations
  from tensorflow.python.distribute import device_util
  from tensorflow.python.distribute import multi_worker_test_base
  from tensorflow.python.eager import context
  from tensorflow.python.framework import ops
  from tensorflow.python.platform import test
  from tensorflow.python.training import server_lib
label_desc: Use image node_id 8 for calling the DeviceUtilTest obj's underlying member method code with example usage: obj.testResolveWithDeviceScope() without return types