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:
Cristhian Zanforlin Lousa 2025-01-16 15:41:17 -03:00 • committed by GitHub
commit c39bb39772
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 13 deletions

View file

@ -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")