code: def test_scaled_float_frame(dtype):
      steps = 10
  
      # Mock env that returns atari-like frames
      def make_env(idx):
          env = mock.Mock()
          np_random = np.random.RandomState(idx)
          if dtype is np.uint8:
  
              def dtyped_rand():
                  return np_random.randint(
                      low=0, high=255, size=(1, 84, 84), dtype=dtype
                  )
  
              low, high = 0, 255
          elif dtype is np.float32:
  
              def dtyped_rand():
                  return np_random.rand(1, 84, 84).astype(dtype)
  
              low, high = -1.0, 3.14
          else:
              assert False
          env.reset.side_effect = [dtyped_rand() for _ in range(steps)]
          env.step.side_effect = [
              (
                  dtyped_rand(),
                  np_random.rand(),
                  bool(np_random.randint(2)),
                  {},
              )
              for _ in range(steps)
          ]
          env.action_space = gym.spaces.Discrete(2)
          env.observation_space = gym.spaces.Box(
              low=low, high=high, shape=(1, 84, 84), dtype=dtype
          )
          return env
  
      env = make_env(42)
      s_env = ScaledFloatFrame(make_env(42))
  
      # check observation space
      assert type(env.observation_space) is type(
          s_env.observation_space
      )  # NOQA
      assert s_env.observation_space.dtype is np.dtype(np.float32)
      assert s_env.observation_space.contains(
          s_env.observation_space.low
      )
      assert s_env.observation_space.contains(
          s_env.observation_space.high
      )
  
      # check reset
      obs = env.reset()
      s_obs = s_env.reset()
      np.testing.assert_allclose(np.array(obs) / s_env.scale, s_obs)
  
      # check step
      for _ in range(steps - 1):
          action = env.action_space.sample()
          s_action = s_env.action_space.sample()
          obs, r, done, info = env.step(action)
          s_obs, s_r, s_done, s_info = s_env.step(s_action)
          np.testing.assert_allclose(np.array(obs) / s_env.scale, s_obs)
          assert r == s_r
          assert done == s_done
  
imports: from unittest import mock
  import gym
  import gym.spaces
  import numpy
  import pytest
  from pfrl.wrappers.atari_wrappers import FrameStack, LazyFrames, ScaledFloatFrame
label_desc: Use image node_id 2 for calling a global function with example usage: test_scaled_float_frame(dtype) and returns: env, np_random, np_random