class_docstr: Unit-test mock environment.
  
  Args:
      states: States specification.
      actions: Actions specification.
      min_timesteps: Minimum number of timesteps.
code: def is_valid_action_function(cls, action_spec):
      dtype = action_spec["type"]
      shape = action_spec.get("shape", ())
  
      if dtype == "bool":
          return lambda action, name, states: (
              (
                  isinstance(action, util.py_dtype("bool"))
                  and shape == ()
              )
              or (
                  isinstance(action, np.ndarray)
                  and action.dtype == util.np_dtype("bool")
                  and action.shape == shape
              )
          )
  
      elif dtype == "int":
          num_values = action_spec["num_values"]
          return lambda action, name, states: (
              (
                  isinstance(action, util.py_dtype("int"))
                  and shape == ()
                  and 0 <= action
                  and action < num_values
                  and states[name + "_mask"][action]
              )
              or (
                  isinstance(action, np.ndarray)
                  and action.dtype == util.np_dtype("int")
                  and action.shape == shape
                  and (0 <= action).all()
                  and (action < num_values).all()
                  and np.take_along_axis(
                      states[name + "_mask"],
                      indices=np.expand_dims(action, axis=-1),
                      axis=-1,
                  ).all()
              )
          )
  
      elif dtype == "float":
          if "min_value" in action_spec:
              min_value = action_spec["min_value"]
              max_value = action_spec["max_value"]
              return lambda action, name, states: (
                  (
                      isinstance(action, util.py_dtype("float"))
                      and shape == ()
                      and min_value <= action
                      and action <= max_value
                  )
                  or (
                      isinstance(action, np.ndarray)
                      and action.dtype == util.np_dtype("float")
                      and action.shape == shape
                      and (min_value <= action).all()
                      and (action <= max_value).all()
                  )
              )
  
          else:
              return lambda action, name, states: (
                  (
                      isinstance(action, util.py_dtype("float"))
                      and shape == ()
                  )
                  or (
                      isinstance(action, np.ndarray)
                      and action.dtype == util.np_dtype("float")
                      and action.shape == shape
                  )
              )
  
file_path: tensorforce/test/unittest_environment.py
imports: from collections import OrderedDict
  from random import random
  import numpy
  from tensorforce import Environment, TensorforceError, util
label_desc: Use image node_id 8 for calling the UnittestEnvironment obj's underlying member method code with example usage: obj.is_valid_action_function(cls, action_spec) and returns: function, function, function, function