class_docstr: Unit tests for QLearning.
class_docstr_tok: ["Unit","tests","for","QLearning","."]
code: def test_populate_replay_memory(self, mock_parameters):
      self._setup_parameters(mock_parameters.return_value)
      mock_parameters.return_value.preprocessing = (
          "cntk.contrib.deeprl.agent.shared.preprocessing.SlidingWindow"
      )
      mock_parameters.return_value.preprocessing_args = "(2, )"
  
      action_space = spaces.Discrete(2)
      observation_space = spaces.Box(0, 1, (1,))
      sut = QLearning("", observation_space, action_space)
  
      sut._compute_priority = Mock(side_effect=[1, 2, 3])
      sut._choose_action = Mock(
          side_effect=[(0, ""), (0, ""), (1, ""), (1, "")]
      )
      sut._replay_memory = MagicMock()
      sut._update_q_periodically = MagicMock()
  
      sut.start(np.array([0.1], np.float32))
      sut.step(0.1, np.array([0.2], np.float32))
      sut.step(0.2, np.array([0.3], np.float32))
      sut.end(0.3, np.array([0.4], np.float32))
  
      self.assertEqual(sut._replay_memory.store.call_count, 3)
  
      call_args = sut._replay_memory.store.call_args_list[0]
      np.testing.assert_array_equal(
          call_args[0][0], np.array([[0], [0.1]], np.float32)
      )
      self.assertEqual(call_args[0][1], 0)
      self.assertEqual(call_args[0][2], 0.1)
      np.testing.assert_array_equal(
          call_args[0][3], np.array([[0.1], [0.2]], np.float32)
      )
      self.assertEqual(call_args[0][4], 1)
  
      call_args = sut._replay_memory.store.call_args_list[2]
      np.testing.assert_array_equal(
          call_args[0][0], np.array([[0.2], [0.3]], np.float32)
      )
      self.assertEqual(call_args[0][1], 1)
      self.assertEqual(call_args[0][2], 0.3)
      self.assertIsNone(call_args[0][3])
      self.assertEqual(call_args[0][4], 3)
  
imports: import unittest
  import cntk.contrib.deeprl.tests.spaces
  import numpy
  from cntk.contrib.deeprl.agent.qlearning import QLearning
  from cntk.contrib.deeprl.agent.shared.cntk_utils import huber_loss
  from cntk.contrib.deeprl.agent.shared.replay_memory import _Transition
  from cntk.layers import Dense
  from cntk.losses import squared_error
  from cntk.ops import input_variable
label_desc: Use image node_id 12 for calling the QLearningTest obj's underlying member method code with example usage: obj.test_populate_replay_memory(mock_parameters) without return types