chore: update type annotations in template, io and inputs modules (#3593)
* refactor(input_mixin.py): update typing annotations for variables to use union types for better clarity and compatibility with Python 3.10 refactor(inputs.py): update typing annotations for variables to use union types and import necessary modules for compatibility with Python 3.10 * refactor(base.py): remove unnecessary imports and update typing for fields in Input and Output classes feat(base.py): add support for specifying field types more explicitly in Input and Output classes feat(frontend_node/base.py): enhance typing and field definitions in FrontendNode class feat(frontend_node/custom_components.py): improve typing and field definitions in CustomComponentFrontendNode and ComponentFrontendNode classes feat(template/base.py): update typing for fields in Template class and remove unnecessary imports * refactor(inputs): remove unnecessary Optional import from typing in input_mixin.py and inputs.py files to improve code readability and maintainability * refactor(schema.py): change 'Type' to 'type' for consistency in type annotations refactor(schema.py): change 'list' to 'List' and 'Literal' to 'literal' for correct type hinting in create_input_schema function * test: fix tests --------- Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
This commit is contained in:
parent
3e19a3fd36
commit
1883710dd1
8 changed files with 63 additions and 63 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from typing import List, Literal
|
||||
from typing import Literal
|
||||
|
||||
import pytest
|
||||
from pydantic.fields import FieldInfo
|
||||
|
|
@ -96,7 +96,7 @@ class TestCreateInputSchema:
|
|||
input_instance = StrInput(name="test_field", is_list=True)
|
||||
schema = create_input_schema([input_instance])
|
||||
field_info: FieldInfo = schema.model_fields["test_field"]
|
||||
assert field_info.annotation == List[str]
|
||||
assert field_info.annotation == list[str]
|
||||
|
||||
# Input with options attribute is processed correctly
|
||||
def test_options_attribute_processing(self):
|
||||
|
|
@ -184,7 +184,7 @@ class TestCreateInputSchema:
|
|||
input_instance = StrInput(name="test_field", is_list=True)
|
||||
schema = create_input_schema([input_instance])
|
||||
field_info = schema.model_fields["test_field"]
|
||||
assert field_info.annotation == List[str]
|
||||
assert field_info.annotation == list[str]
|
||||
|
||||
# Converting FieldTypes to corresponding Python types
|
||||
def test_field_types_conversion(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue