Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove _study_id parameter from Trial class #4811

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions optuna/trial/_trial.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ def __init__(self, study: "optuna.study.Study", trial_id: int) -> None:
self.study = study
self._trial_id = trial_id

# TODO(Yanase): Remove _study_id attribute, and use study._study_id instead.
self._study_id = self.study._study_id
self.storage = self.study._storage

self._cached_frozen_trial = self.storage.get_trial(self._trial_id)
Expand Down
7 changes: 0 additions & 7 deletions tests/trial_tests/test_trial.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,13 +613,6 @@ def test_report_warning() -> None:
trial.report(1, 1)


def test_study_id() -> None:
study = create_study()
trial = Trial(study, study._storage.create_new_trial(study._study_id))

assert trial._study_id == trial.study._study_id


def test_suggest_with_multi_objectives() -> None:
study = create_study(directions=["maximize", "maximize"])

Expand Down