docstr: Test stochastic action sampling in case that one of the control states is one-dimensional, within the agent
  method `sample_action()`.
  Due to a call to probabilities.squeeze() in an earlier version of utils.sample(), this was throwing an
  error due to the inability to use np.random.multinomial on an array with undefined length (an 'unsized' array)
docstr_tok: ["Test","stochastic","action","sampling","in","case","that","one","of","the","control","states","is","one-dimensional",",","within","the","agent","method","`","sample_action","(",")","`",".","Due","to","a","call","to","probabilities.squeeze","(",")","in","an","earlier","version","of","utils.sample","(",")",",","this","was","throwing","an","error","due","to","the","inability","to","use","np.random.multinomial","on","an","array","with","undefined","length","(","an","'unsized","'","array",")"]
code: def test_agent_with_stochastic_action_unidimensional_control(self):
      """
      Test stochastic action sampling in case that one of the control states is one-dimensional, within the agent
      method `sample_action()`.
      Due to a call to probabilities.squeeze() in an earlier version of utils.sample(), this was throwing an
      error due to the inability to use np.random.multinomial on an array with undefined length (an 'unsized' array)
      """
  
      num_obs = [2]
      num_states = [2, 2]
      num_controls = [2, 1]
  
      A = utils.random_A_matrix(num_obs, num_states)
      B = utils.random_B_matrix(num_states, num_controls)
  
      agent = Agent(A=A, B=B, action_selection="stochastic")
      agent.infer_policies()
      chosen_action = agent.sample_action()
      self.assertEqual(chosen_action[1], 0)
  
      agent = Agent(A=A, B=B, action_selection="deterministic")
      agent.infer_policies()
      chosen_action = agent.sample_action()
      self.assertEqual(chosen_action[1], 0)
  
imports: import os
  import unittest
  import numpy
  from copy import deepcopy
  from pymdp.agent import Agent
  from pymdp import utils, maths
  from pymdp import inference, control, learning
  from pymdp.default_models import generate_grid_world_transitions
label_desc: Use image node_id 12 for calling the TestAgent obj's underlying member method code with example usage: obj.test_agent_with_stochastic_action_unidimensional_control() without return types