Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
teubert committed Jul 24, 2024
1 parent fdd7640 commit 0c655e7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_predictors.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,22 @@ def test_MC_ThrownObject(self):
results = mc.predict(m.initialize(), dt=0.2, num_samples=3, save_freq=1, event_strategy='all')
self.assertAlmostEqual(results.time_of_event.mean['impact'], 8.0, 5)
self.assertAlmostEqual(results.time_of_event.mean['falling'], 3.8, 5)

# Setting event manually
results = mc.predict(m.initialize(), dt=0.2, num_samples=3, save_freq=1, events=['falling'])
self.assertAlmostEqual(results.time_of_event.mean['falling'], 3.8, 5)
self.assertNotIn('impact', results.time_of_event.mean)

# Setting event in construction
mc = MonteCarlo(m, events=['falling'])
results = mc.predict(m.initialize(), dt=0.2, num_samples=3, save_freq=1)
self.assertAlmostEqual(results.time_of_event.mean['falling'], 3.8, 5)
self.assertNotIn('impact', results.time_of_event.mean)

# Override event set in construction
results = mc.predict(m.initialize(), dt=0.2, num_samples=3, save_freq=1, events=['falling', 'impact'])
self.assertAlmostEqual(results.time_of_event.mean['falling'], 3.8, 5)
self.assertAlmostEqual(results.time_of_event.mean['impact'], 8.0, 5)

def test_MC_ThrownObject_First(self):
# Test thrown object, similar to test_UKP_ThrownObject, but with only the first event (i.e., 'falling')
Expand Down

0 comments on commit 0c655e7

Please sign in to comment.