Пример #1
0
    def test_cascade_delete_on_trial(session: Session) -> None:

        trial = TestTrialValueModel._create_model(session)
        trial.values.append(TrialValueModel(trial_id=1, objective=1, value=20))
        session.commit()

        assert 2 == len(TrialValueModel.where_trial_id(trial.trial_id, session))

        session.delete(trial)
        session.commit()

        assert 0 == len(TrialValueModel.where_trial_id(trial.trial_id, session))
Пример #2
0
    def test_where_trial_id(session: Session) -> None:

        trial = TestTrialValueModel._create_model(session)
        trial_values = TrialValueModel.where_trial_id(trial.trial_id, session)
        assert 1 == len(trial_values)
        assert 0 == trial_values[0].objective
        assert 10 == trial_values[0].value