code: def test_action_ratio(random_fraction):
      env = ActionRecordingEnv()
      env = pfrl.wrappers.RandomizeAction(
          env, random_fraction=random_fraction
      )
      env.reset()
      n = 1000
      delta = 0.05
      for _ in range(n):
          # Always send action 0
          env.step(0)
      # Ratio of selected actions should be:
      #   0: (1 - random_fraction) + random_fraction/3
      #   1: random_fraction/3
      #   2: random_fraction/3
      np.testing.assert_allclose(
          env.env.past_actions.count(0) / n,
          (1 - random_fraction) + random_fraction / 3,
          atol=delta,
      )
      np.testing.assert_allclose(
          env.env.past_actions.count(1) / n,
          random_fraction / 3,
          atol=delta,
      )
      np.testing.assert_allclose(
          env.env.past_actions.count(2) / n,
          random_fraction / 3,
          atol=delta,
      )
  
file_path: pfrl/tests/wrappers_tests/test_randomize_action.py
imports: import gym
  import gym.spaces
  import numpy
  import pytest
  import pfrl
label_desc: Use image node_id 1 for calling a global function with example usage: test_action_ratio(random_fraction) without return types