Skip to content

Commit

Permalink
All tests are passing and done
Browse files Browse the repository at this point in the history
  • Loading branch information
goobta committed Feb 8, 2021
1 parent f86d415 commit bbe6b2b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions gym_solo/core/test_obs_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,25 @@ def test_get_obs_multiple_observations(self):
np.array([1, 2, 5, 6]))
self.assertListEqual(labels, ['1', '2', '5', '6'])

def test_get_obs_normalized(self):
of = obs.ObservationFactory(self.client, normalize=True)

test_obs1 = CompliantObs(None)
test_obs1.compute = lambda: np.array([1.5, 1.5])
of.register_observation(test_obs1)

test_obs2 = CompliantObs(None)
test_obs2.compute = lambda: np.array([0., 0.])
of.register_observation(test_obs2)

test_obs3 = CompliantObs(None)
test_obs3.compute = lambda: np.array([3., 3.])
of.register_observation(test_obs3)

observations, _ = of.get_obs()
np.testing.assert_array_equal(observations,
np.array([0., 0., -1., -1., 1., 1.]))

def test_get_observation_space_no_observations(self):
of = obs.ObservationFactory(self.client)
with self.assertRaises(ValueError):
Expand Down

0 comments on commit bbe6b2b

Please sign in to comment.