Skip to content

Commit

Permalink
Undo pep585_imports in test_kwargutils (facebook#2672)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#2672

For whatever reason validate_kwarg_typing does not play well with this change ONLY IN GITHUB ACTIONS. **Tests pass internally with or without this change.**

Reviewed By: esantorella

Differential Revision: D61480862
  • Loading branch information
mpolson64 authored and facebook-github-bot committed Aug 19, 2024
1 parent 885288e commit fa1a19f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ax/utils/common/tests/test_kwargutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


from logging import Logger
from typing import Callable, Optional
from typing import Callable, Dict, Optional
from unittest.mock import patch

from ax.utils.common.kwargs import validate_kwarg_typing, warn_on_kwargs
Expand All @@ -23,7 +23,7 @@ def test_validate_kwarg_typing(self) -> None:
def typed_callable(arg1: int, arg2: Optional[str] = None) -> None:
pass

def typed_callable_with_dict(arg3: int, arg4: dict[str, int]) -> None:
def typed_callable_with_dict(arg3: int, arg4: Dict[str, int]) -> None:
pass

def typed_callable_valid(arg3: int, arg4: Optional[str] = None) -> None:
Expand All @@ -33,7 +33,7 @@ def typed_callable_dup_keyword(arg2: int, arg4: Optional[str] = None) -> None:
pass

def typed_callable_with_callable(
arg1: int, arg2: Callable[[int], dict[str, int]]
arg1: int, arg2: Callable[[int], Dict[str, int]]
) -> None:
pass

Expand Down Expand Up @@ -102,7 +102,7 @@ def typed_callable_extra_arg(arg1: int, arg2: str, arg3: bool) -> None:
validate_kwarg_typing(typed_callables, **kwargs)
expected_message = (
f"`{typed_callable_with_dict}` expected argument `arg4` to be of type"
f" dict[str, int]. Got {str_dic} (type: {type(str_dic)})."
f" typing.Dict[str, int]. Got {str_dic} (type: {type(str_dic)})."
)
mock_warning.assert_called_once_with(expected_message)

Expand All @@ -113,7 +113,7 @@ def typed_callable_extra_arg(arg1: int, arg2: str, arg3: bool) -> None:
validate_kwarg_typing(typed_callables, **kwargs)
expected_message = (
f"`{typed_callable_with_callable}` expected argument `arg2` to be of"
f" type typing.Callable[[int], dict[str, int]]. "
f" type typing.Callable[[int], typing.Dict[str, int]]. "
f"Got test_again (type: {type('test_again')})."
)
mock_warning.assert_called_once_with(expected_message)
Expand Down

0 comments on commit fa1a19f

Please sign in to comment.