code: def testActionScalarSpec(self):
      action_spec = tensor_spec.BoundedTensorSpec((), tf.int32, 0, 1)
      policy = q_policy.QPolicy(
          self._time_step_spec, action_spec, q_network=DummyNet()
      )
  
      observations = tf.constant([[1, 2], [3, 4]], dtype=tf.float32)
      time_step = ts.restart(observations, batch_size=2)
      action_step = policy.action(time_step, seed=1)
      self.assertEqual(action_step.action.shape.as_list(), [2])
      self.assertEqual(action_step.action.dtype, tf.int32)
      # Initialize all variables
      self.evaluate(tf.compat.v1.global_variables_initializer())
      action = self.evaluate(action_step.action)
      self.assertTrue(np.all(action >= 0) and np.all(action <= 1))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  from tf_agents.networks import network
  from tf_agents.networks import q_network
  from tf_agents.policies import q_policy
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import time_step
  from tf_agents.utils import test_utils
label_desc: Use image node_id 6 for calling the QPolicyTest obj's underlying member method code with example usage: obj.testActionScalarSpec() without return types