Skip to content

Move type-only datetime import in tests/trial_tests/test_trial.py - #6544

Merged
not522 merged 1 commit into
optuna:masterfrom
t7r0n:fix/type-checking-tests-trial-6029
Mar 23, 2026
Merged

not522 merged 1 commit into
optuna:masterfrom
t7r0n:fix/type-checking-tests-trial-6029

Conversation

@t7r0n

@t7r0n t7r0n commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • move type-only standard library import (datetime) in tests/trial_tests/test_trial.py under TYPE_CHECKING
  • keep runtime behavior unchanged while satisfying Ruff TC003

Motivation

Testing

  • uv run ruff check tests/trial_tests/test_trial.py --select TCH
  • uv run ruff check tests/trial_tests/test_trial.py
  • uv run ruff format --check tests/trial_tests/test_trial.py
  • uv run mypy tests/trial_tests/test_trial.py
  • uv run pytest tests/trial_tests/test_trial.py -q

Part of #6029

@not522 not522 changed the title test: move type-only datetime import in tests/trial_tests/test_trial.py Move type-only datetime import in tests/trial_tests/test_trial.py Mar 23, 2026

@not522 not522 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@not522 not522 changed the title Move type-only datetime import in tests/trial_tests/test_trial.py Move type-only datetime import in tests/trial_tests/test_trial.py Mar 23, 2026
@not522 not522 added the code-fix Change that does not change the behavior, such as code refactoring. label Mar 23, 2026
@not522 not522 added this to the v4.9.0 milestone Mar 23, 2026
@not522
not522 merged commit bcde9db into optuna:master Mar 23, 2026
13 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