code: def test_cascade_delete_on_trial(session: Session) -> None:
      trial_id = 1
      direction = StudyDirectionModel(
          direction=StudyDirection.MINIMIZE, objective=0
      )
      study = StudyModel(
          study_id=1, study_name="test-study", directions=[direction]
      )
      trial = TrialModel(
          trial_id=trial_id,
          study_id=study.study_id,
          state=TrialState.COMPLETE,
      )
      trial.system_attributes.append(
          TrialSystemAttributeModel(
              trial_id=trial_id, key="sample-key1", value_json="1"
          )
      )
      trial.system_attributes.append(
          TrialSystemAttributeModel(
              trial_id=trial_id, key="sample-key2", value_json="2"
          )
      )
      study.trials.append(trial)
      session.add(study)
      session.commit()
  
      assert 2 == len(
          TrialSystemAttributeModel.where_trial_id(trial_id, session)
      )
  
      session.delete(trial)
      session.commit()
  
      assert 0 == len(
          TrialSystemAttributeModel.where_trial_id(trial_id, session)
      )
  
imports: from datetime import datetime
  import pytest
  from sqlalchemy import create_engine
  from sqlalchemy.exc import IntegrityError
  from sqlalchemy.orm import Session
  from optuna.storages._rdb.models import BaseModel
  from optuna.storages._rdb.models import StudyDirectionModel
  from optuna.storages._rdb.models import StudyModel
  from optuna.storages._rdb.models import StudySystemAttributeModel
  from optuna.storages._rdb.models import TrialHeartbeatModel
  from optuna.storages._rdb.models import TrialIntermediateValueModel
  from optuna.storages._rdb.models import TrialModel
  from optuna.storages._rdb.models import TrialSystemAttributeModel
  from optuna.storages._rdb.models import TrialUserAttributeModel
  from optuna.storages._rdb.models import TrialValueModel
  from optuna.storages._rdb.models import VersionInfoModel
  from optuna.study._study_direction import StudyDirection
  from optuna.trial import TrialState
label_desc: Use image node_id 2 for calling the TestTrialSystemAttributeModel obj's underlying member method code with example usage: obj.test_cascade_delete_on_trial(session) without return types