Skip to content

Use TYPE_CHECKING for typing-only imports in test_timeline.py#6451

Merged
y0z merged 1 commit intooptuna:masterfrom
KRMed:fix/issue-6029-type-checking-test-visualization
Feb 18, 2026
Merged

Use TYPE_CHECKING for typing-only imports in test_timeline.py#6451
y0z merged 1 commit intooptuna:masterfrom
KRMed:fix/issue-6029-type-checking-test-visualization

Conversation

@KRMed
Copy link
Copy Markdown
Contributor

@KRMed KRMed commented Feb 17, 2026

Summary

Move typing-only imports in optuna/tests/visualization_tests/test_timeline.py under if TYPE_CHECKING guard to prevent potential circular import issues

Motivation

Description of the changes

  • Added from typing import TYPE_CHECKING

  • Moved from collections.abc import Callable, import _pytest.capture, and from optuna.study.study import Study under TYPE_CHECKING block

@y0z y0z added the code-fix Change that does not change the behavior, such as code refactoring. label Feb 18, 2026
@y0z y0z added this to the v4.8.0 milestone Feb 18, 2026
Copy link
Copy Markdown
Member

@y0z y0z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@y0z y0z merged commit e68c528 into optuna:master Feb 18, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-fix Change that does not change the behavior, such as code refactoring.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants