Skip to content

Commit

Permalink
Quick fix #515
Browse files Browse the repository at this point in the history
  • Loading branch information
wyfo committed Dec 11, 2022
1 parent 41f62d4 commit 14d2e45
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion apischema/conversions/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@ def converter_types(
def is_convertible(tp: AnyType) -> bool:
origin = get_origin_or_type(tp)
return is_new_type(tp) or (
is_type(origin) and not (is_literal(tp) or is_annotated(tp) or is_union(origin))
is_type(origin)
and not (tp is Any or is_literal(tp) or is_annotated(tp) or is_union(origin))
)
2 changes: 1 addition & 1 deletion apischema/json_schema/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class JsonType(str, Enum):
def from_type(cls: Type) -> "JsonType":
return TYPE_TO_JSON_TYPE[cls]

def __str__(self) -> str:
def __str__(self):
return self.value


Expand Down
2 changes: 1 addition & 1 deletion apischema/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def typing_origin(origin: Any) -> Any:

def is_type(tp: Any) -> bool:
"""isinstance is not enough because in py39: isinstance(list[int], type) == True"""
return isinstance(tp, type) and not get_args(tp) and tp is not Any
return isinstance(tp, type) and not get_args(tp)


def is_union(tp: Any) -> bool:
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def hello() -> str:
@pytest.mark.parametrize("conversion", [None, event_name])
@pytest.mark.parametrize("error_handler", [Undefined, None])
@pytest.mark.parametrize("resolver", [None, events2])
@pytest.mark.asyncio
async def test_subscription(alias, conversion, error_handler, resolver):
if alias is not None:
sub_name = alias
Expand Down

0 comments on commit 14d2e45

Please sign in to comment.