code: def test_infinite_space(space):
      """
      To test spaces that are passed in have only 0 or infinite bounds because `space.high` and `space.low`
       are both modified within the init, we check for infinite when we know it's not 0
      """
  
      assert np.all(
          space.low < space.high
      ), f"Box low bound ({space.low}) is not lower than the high bound ({space.high})"
  
      space.seed(0)
      sample = space.sample()
  
      # check if space contains sample
      assert (
          sample in space
      ), f"Sample ({sample}) not inside space according to `space.contains()`"
  
      # manually check that the sign of the sample is within the bounds
      assert np.all(
          np.sign(sample) <= np.sign(space.high)
      ), f"Sign of sample ({sample}) is less than space upper bound ({space.high})"
      assert np.all(
          np.sign(space.low) <= np.sign(sample)
      ), f"Sign of sample ({sample}) is more than space lower bound ({space.low})"
  
      # check that int bounds are bounded for everything
      # but floats are unbounded for infinite
      if np.any(space.high != 0):
          assert (
              space.is_bounded("above") is False
          ), "inf upper bound supposed to be unbounded"
      else:
          assert (
              space.is_bounded("above") is True
          ), "non-inf upper bound supposed to be bounded"
  
      if np.any(space.low != 0):
          assert (
              space.is_bounded("below") is False
          ), "inf lower bound supposed to be unbounded"
      else:
          assert (
              space.is_bounded("below") is True
          ), "non-inf lower bound supposed to be bounded"
  
      if np.any(space.low != 0) or np.any(space.high != 0):
          assert space.is_bounded("both") is False
      else:
          assert space.is_bounded("both") is True
  
      # check for dtype
      assert (
          space.high.dtype == space.dtype
      ), f"High's dtype {space.high.dtype} doesn't match `space.dtype`'"
      assert (
          space.low.dtype == space.dtype
      ), f"Low's dtype {space.high.dtype} doesn't match `space.dtype`'"
  
      with pytest.raises(
          ValueError,
          match="manner is not in {'below', 'above', 'both'}, actual value:",
      ):
          space.is_bounded("test")
  
file_path: gym/tests/spaces/test_box.py
imports: import re
  import warnings
  import numpy
  import pytest
  import gym.error
  from gym.spaces import Box
  from gym.spaces.box import get_inf
label_desc: Use image node_id 5 for calling a global function with example usage: test_infinite_space(space) without return types