def test_correct_loading():
     sel = SpringShootingSelector(delta_max=1, k_spring=0, initial_guess=3)
     details = Details(initial_trajectory='foo',
                       last_accepted_shooting_index='bar',
                       shooting_index=13,
                       direction='forward')
     step = FakeStep(details)
     sel.restart_from_step(step)
     assert sel.previous_trajectory == 'foo'
     assert sel.previous_snapshot == 'bar'
     assert sel.trial_snapshot == 13
     details.direction = 'backward'
     step = FakeStep(details)
     sel.restart_from_step(step)
     assert sel.trial_snapshot == 10
 def test_failed_loading():
     sel = SpringShootingSelector(delta_max=1, k_spring=0, initial_guess=3)
     details = Details(foo='bar')
     step = FakeStep(details)
     with pytest.raises(RuntimeError):
         sel.restart_from_step(step)