From b29fdff87e46fd1c1e025e23af005c9a9ad80a11 Mon Sep 17 00:00:00 2001 From: Siva Kottapalli <64937409+boringbyte@users.noreply.github.com> Date: Sun, 1 Dec 2024 00:00:04 -0500 Subject: [PATCH] fix type annotations for 'tests/pruners_tests/test_percentile.py' (#5808) --- tests/pruners_tests/test_percentile.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/pruners_tests/test_percentile.py b/tests/pruners_tests/test_percentile.py index 40710317a6..bba2501e67 100644 --- a/tests/pruners_tests/test_percentile.py +++ b/tests/pruners_tests/test_percentile.py @@ -1,6 +1,6 @@ +from __future__ import annotations + import math -from typing import List -from typing import Tuple import warnings import pytest @@ -65,7 +65,7 @@ def test_percentile_pruner_with_one_trial() -> None: "direction_value", [("minimize", [1, 2, 3, 4, 5], 2.1), ("maximize", [1, 2, 3, 4, 5], 3.9)] ) def test_25_percentile_pruner_intermediate_values( - direction_value: Tuple[str, List[float], float] + direction_value: tuple[str, list[float], float] ) -> None: direction, intermediate_values, latest_value = direction_value pruner = optuna.pruners.PercentilePruner(25.0, 0, 0) @@ -112,7 +112,7 @@ def test_25_percentile_pruner_intermediate_values_nan() -> None: "direction_expected", [(StudyDirection.MINIMIZE, 0.1), (StudyDirection.MAXIMIZE, 0.2)] ) def test_get_best_intermediate_result_over_steps( - direction_expected: Tuple[StudyDirection, float] + direction_expected: tuple[StudyDirection, float] ) -> None: direction, expected = direction_expected @@ -161,7 +161,7 @@ def test_get_best_intermediate_result_over_steps( def test_get_percentile_intermediate_result_over_trials() -> None: - def setup_study(trial_num: int, _intermediate_values: List[List[float]]) -> Study: + def setup_study(trial_num: int, _intermediate_values: list[list[float]]) -> Study: _study = optuna.study.create_study(direction="minimize") trial_ids = [_study._storage.create_new_trial(_study._study_id) for _ in range(trial_num)]