fix: pass slider input values correctly, add test (#5735)
* ✨ (base.py): Update field validation to include "slider" type in addition to "float" type for better parameter handling 📝 (constants.py): Add "slider" type to the list of DIRECT_TYPES for consistency and completeness * ✅ (test_inputs.py): add unit test for SliderInput class to ensure it initializes with correct value * 🐛 (base.py): fix comparison of field type with a list by changing it to a set to ensure correct condition evaluation * [autofix.ci] apply automated fixes * fix format * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
99f2ef6115
commit
c39bb39772
3 changed files with 8 additions and 13 deletions
|
|
@ -17,6 +17,7 @@ from langflow.inputs.inputs import (
|
|||
NestedDictInput,
|
||||
PromptInput,
|
||||
SecretStrInput,
|
||||
SliderInput,
|
||||
StrInput,
|
||||
TableInput,
|
||||
)
|
||||
|
|
@ -30,6 +31,11 @@ def test_table_input_valid():
|
|||
assert data.value == [{"key": "value"}, {"key2": "value2"}]
|
||||
|
||||
|
||||
def test_slider_input_valid():
|
||||
data = SliderInput(name="valid_slider", value=10)
|
||||
assert data.value == 10
|
||||
|
||||
|
||||
def test_table_input_invalid():
|
||||
with pytest.raises(ValidationError):
|
||||
TableInput(name="invalid_table", value="invalid")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue