fix: update type extraction to extract inner types correctly (#3446)
* refactor: Improve post-processing of return type in type extraction. * feat: Add support for Union[int, Sequence[str]] in post_process_type. * refactor(langflow): Simplify return type extraction in CustomComponent. * Refactor: Remove 'Sequence' and 'list' type options in starter projects. * test: fix assertion --------- Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
This commit is contained in:
parent
de96aee509
commit
037c0902d5
6 changed files with 18 additions and 37 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from typing import Union
|
||||
from typing import Sequence, Union
|
||||
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
|
@ -42,6 +42,8 @@ class TestInput:
|
|||
assert post_process_type(int) == [int]
|
||||
assert post_process_type(list[int]) == [int]
|
||||
assert post_process_type(Union[int, str]) == [int, str]
|
||||
assert post_process_type(Union[int, Sequence[str]]) == [int, str]
|
||||
assert post_process_type(Union[int, Sequence[int]]) == [int]
|
||||
|
||||
def test_input_to_dict(self):
|
||||
input_obj = Input(field_type="str")
|
||||
|
|
@ -126,4 +128,4 @@ class TestPostProcessType:
|
|||
class CustomType:
|
||||
pass
|
||||
|
||||
assert post_process_type(Union[CustomType, int]) == [CustomType, int]
|
||||
assert set(post_process_type(Union[CustomType, int])) == {CustomType, int}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue