Skip to content

Commit

Permalink
Make conversion to Iterable tighter (#25866)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmccluskey committed Mar 17, 2023
1 parent de578e6 commit 7555d98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def convert_collections_to_typing(typ):
typ = typing.Iterator[typ.__args__]
elif hasattr(typ, 'send') and hasattr(typ, 'throw'):
typ = typing.Generator[typ.__args__]
else:
elif _match_is_exactly_iterable(typ):
typ = typing.Iterable[typ.__args__]
return typ

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ def test_convert_to_beam_type_with_collections_types(self):
'nested iterable',
tuple[bytes, collections.abc.Iterable[int]],
typehints.Tuple[bytes, typehints.Iterable[int]]),
(
'iterable over tuple',
collections.abc.Iterable[tuple[str, int]],
typehints.Iterable[typehints.Tuple[str, int]]),
(
'mapping not caught',
collections.abc.Mapping[str, int],
collections.abc.Mapping[str, int]),
]

for test_case in test_cases:
Expand Down

0 comments on commit 7555d98

Please sign in to comment.