class_docstr: Unit tests for policy gradient.
class_docstr_tok: ["Unit","tests","for","policy","gradient","."]
code: def test_process_accumulated_trajectory_keep_last(self):
      action_space = spaces.Discrete(2)
      observation_space = spaces.Box(0, 1, (1,))
      sut = ActorCritic("", observation_space, action_space)
  
      # Set up.
      self._setup_trajectory(sut)
  
      # Call test method.
      sut._process_accumulated_trajectory(True)
  
      # Verify results.
      self.assertEqual(len(sut._trajectory_rewards), 0)
      self.assertEqual(len(sut._trajectory_actions), 0)
      self.assertEqual(
          sut._trajectory_states, [np.array([0.3], np.float32)]
      )
  
imports: import unittest
  import cntk.contrib.deeprl.tests.spaces
  import numpy
  from cntk.contrib.deeprl.agent.policy_gradient import ActorCritic
  from cntk.layers import Dense
  from cntk.losses import cross_entropy_with_softmax
  from cntk.ops import input_variable, placeholder
label_desc: Use image node_id 11 for calling the PolicyGradientTest obj's underlying member method code with example usage: obj.test_process_accumulated_trajectory_keep_last() without return types