Skip to content

Commit

Permalink
Merge pull request optuna#909 from c-bata/update-type-annotations-tests
Browse files Browse the repository at this point in the history
Update type annotations in `python_tests`
  • Loading branch information
c-bata authored Jul 23, 2024
2 parents 66ad041 + 640f83e commit 2aee3f8
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 8 deletions.
2 changes: 2 additions & 0 deletions python_tests/artifact/test_backend.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import base64
import json
import tempfile
Expand Down
2 changes: 2 additions & 0 deletions python_tests/artifact/test_backoff.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import io
import uuid

Expand Down
2 changes: 2 additions & 0 deletions python_tests/artifact/test_boto3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import io
from unittest import TestCase

Expand Down
2 changes: 2 additions & 0 deletions python_tests/artifact/test_file_system.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import io
import tempfile
from unittest import TestCase
Expand Down
2 changes: 2 additions & 0 deletions python_tests/artifact/test_prefix.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import io
import uuid

Expand Down
2 changes: 2 additions & 0 deletions python_tests/preferential/samplers/test_gp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import sys
from unittest.mock import patch

Expand Down
7 changes: 4 additions & 3 deletions python_tests/streamlit/test_streamlit_helper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import itertools
from typing import Sequence
from typing import Union

import optuna
from optuna_dashboard import ChoiceWidget
Expand Down Expand Up @@ -60,7 +61,7 @@ def test_render_trial_note_without_note() -> None:

@pytest.mark.parametrize("widgets", widgets_combinations_for_user_attr)
def test_render_user_attr_form_widgets(
widgets: Sequence[Union[ChoiceWidget, SliderWidget, TextInputWidget]],
widgets: Sequence[ChoiceWidget | SliderWidget | TextInputWidget],
) -> None:
study = optuna.create_study()
register_user_attr_form_widgets(study, widgets) # type: ignore
Expand All @@ -77,7 +78,7 @@ def test_render_user_attr_form_widgets(

@pytest.mark.parametrize("widgets", widgets_combinations_for_objective)
def test_render_objective_form_widgets(
widgets: Sequence[Union[ChoiceWidget, SliderWidget, TextInputWidget]],
widgets: Sequence[ChoiceWidget | SliderWidget | TextInputWidget],
) -> None:
study = optuna.create_study(directions=["maximize"] * len(widgets))
register_objective_form_widgets(study, widgets) # type: ignore
Expand Down
8 changes: 3 additions & 5 deletions python_tests/wsgi_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import io
import typing
from typing import Optional
from typing import Union

from bottle import Bottle
from optuna_dashboard._storage import trials_cache
Expand Down Expand Up @@ -58,9 +56,9 @@ def send_request(
app: Bottle,
path: str,
method: str,
body: Union[str, bytes] = b"",
queries: Optional[dict[str, str]] = None,
headers: Optional[dict[str, str]] = None,
body: str | bytes = b"",
queries: dict[str, str] | None = None,
headers: dict[str, str] | None = None,
content_type: str = "text/plain; charset=utf-8",
) -> tuple[int, list[tuple[str, str]], bytes]:
status: str = ""
Expand Down

0 comments on commit 2aee3f8

Please sign in to comment.