code: def testDisallowedAction(self, batch_size, num_actions):
      observation_distribution = tfd.Independent(
          tfd.Normal(
              tf.zeros([batch_size, 2]), tf.ones([batch_size, 2])
          )
      )
      reward_distribution = tfd.Normal(
          tf.zeros(batch_size), tf.ones(batch_size)
      )
      action_spec = tensor_spec.BoundedTensorSpec(
          shape=(), minimum=0, maximum=num_actions - 1, dtype=tf.int32
      )
  
      env = random_bandit_environment.RandomBanditEnvironment(
          observation_distribution, reward_distribution, action_spec
      )
      masked_env = masked_tf_env.BernoulliActionMaskTFEnvironment(
          env, lambda x, y: (x, y), 0.0
      )
      _, mask = self.evaluate(masked_env.reset().observation)
      surely_disallowed_actions = tf.argmin(
          mask, axis=-1, output_type=tf.int32
      )
      with self.assertRaisesRegex(
          tf.errors.InvalidArgumentError, "not in allowed"
      ):
          self.evaluate(
              masked_env.step(surely_disallowed_actions).reward
          )
  
file_path: agents/tf_agents/bandits/environments/bernoulli_action_mask_tf_environment_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import tensorflow
  import tensorflow_probability
  from tf_agents.bandits.environments import bernoulli_action_mask_tf_environment
  from tf_agents.bandits.environments import random_bandit_environment
  from tf_agents.specs import tensor_spec
label_desc: Use image node_id 3 for calling the BernoulliActionMaskTfEnvironmentTest obj's underlying member method code with example usage: obj.testDisallowedAction(batch_size, num_actions) without return types