Ejemplo n.º 1
0
def test_BoxSpace_init(env):
    space = spaces.BoxSpace(env.observation_space)
    expected_result = np.array(
        [4.8000002e00, 3.4028235e38, 4.1887903e-01, 3.4028235e38],
        dtype=np.float32)

    assert space.shape == (4, )
    np.testing.assert_array_almost_equal(space.high, expected_result)
Ejemplo n.º 2
0
def test_BoxSpace_continuous_space(env):
    space = spaces.BoxSpace(env.observation_space)
    result = space.continuous_space()
    expected_result = np.array(
        [
            [-4.8000002e00, -3.4028235e38, -4.1887903e-01, -3.4028235e38],
            [4.8000002e00, 3.4028235e38, 4.1887903e-01, 3.4028235e38],
        ],
        dtype=np.float32,
    )

    np.testing.assert_array_almost_equal(result, expected_result)
Ejemplo n.º 3
0
def test_BoxSpace_discrete_space(env):
    space = spaces.BoxSpace(env.observation_space)
    result = space.discrete_space()
    expected_result = np.array([])
    np.testing.assert_array_equal(result, expected_result)
Ejemplo n.º 4
0
def test_BoxSpace_repr(env):
    space = spaces.BoxSpace(env.observation_space)
    assert repr(space) == "Box(4,)"
Ejemplo n.º 5
0
def test_equal_spaces(env):
    space_1 = spaces.BoxSpace(env.observation_space)
    space_2 = spaces.DiscreteSpace(env.action_space)

    assert space_1 == space_1
    assert space_1 != space_2