class_docstr: Unit tests for QLearning.
class_docstr_tok: ["Unit","tests","for","QLearning","."]
code: def test_init_dqn_preprocessing(
      self, mock_parameters, mock_replay_memory
  ):
      self._setup_parameters(mock_parameters.return_value)
      mock_parameters.return_value.preprocessing = "cntk.contrib.deeprl.agent.shared.preprocessing.AtariPreprocessing"
      mock_parameters.return_value.preprocessing_args = "()"
  
      action_space = spaces.Discrete(2)
      observation_space = spaces.Box(0, 1, (1,))
      sut = QLearning("", observation_space, action_space)
  
      # Preprocessor with default arguments.
      self.assertIsNotNone(sut._preprocessor)
      self.assertEqual(sut._preprocessor.output_shape(), (4, 84, 84))
  
      # Preprocessor with arguments passed as a tuple.
      mock_parameters.return_value.preprocessing_args = "(3,)"
      sut = QLearning("", observation_space, action_space)
      self.assertEqual(sut._preprocessor.output_shape(), (3, 84, 84))
  
      # Preprocessor with inappropriate arguments.
      mock_parameters.return_value.preprocessing_args = "(3, 4)"
      self.assertRaises(
          TypeError, QLearning, "", observation_space, action_space
      )
  
      # Undefined preprocessor.
      mock_parameters.return_value.preprocessing = "undefined"
      self.assertRaises(
          ValueError, QLearning, "", observation_space, action_space
      )
  
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 3 for calling the QLearningTest obj's underlying member method code with example usage: obj.test_init_dqn_preprocessing(mock_parameters, mock_replay_memory) without return types