def test_physicality_hanging():
    # Apply a bunch of non-torque actions, ensure that monotonically accelerate

    LEFT_FORCE = 0
    NO_FORCE = 1
    RIGHT_FORCE = 2

    domain = InfCartPoleSwingUp()
    domain.force_noise_max = 0 # no stochasticity in applied FORCE

    # Positive angle (right)
    s = np.array([179.6 * np.pi/180.0, 0.0]) # pendulum hanging down
    domain.state = s

    for i in np.arange(5): # do for 5 steps and ensure works
        domain.step(NO_FORCE)
        assert np.abs(domain.state[0]) <=179.5 # angle does not increase
        assert np.abs(domain.state[1]) <= 0.1 # angular rate does not increase
        s = domain.state
Test that energy does not spontaneously enter system
dataset/ETHPy150Open rlpy/rlpy/tests/test_domains/test_InfiniteTrackCartPole.py/test_physicality_hanging