Allow step size any for number selector in slider mode (#105978)
This commit is contained in:
parent
b671de8942
commit
2515e520c1
2 changed files with 1 additions and 9 deletions
|
@ -951,9 +951,6 @@ def validate_slider(data: Any) -> Any:
|
||||||
if "min" not in data or "max" not in data:
|
if "min" not in data or "max" not in data:
|
||||||
raise vol.Invalid("min and max are required in slider mode")
|
raise vol.Invalid("min and max are required in slider mode")
|
||||||
|
|
||||||
if "step" in data and data["step"] == "any":
|
|
||||||
raise vol.Invalid("step 'any' is not allowed in slider mode")
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -396,6 +396,7 @@ def test_assist_pipeline_selector_schema(
|
||||||
({"min": 10, "max": 1000, "mode": "slider", "step": 0.5}, (), ()),
|
({"min": 10, "max": 1000, "mode": "slider", "step": 0.5}, (), ()),
|
||||||
({"mode": "box"}, (10,), ()),
|
({"mode": "box"}, (10,), ()),
|
||||||
({"mode": "box", "step": "any"}, (), ()),
|
({"mode": "box", "step": "any"}, (), ()),
|
||||||
|
({"mode": "slider", "min": 0, "max": 1, "step": "any"}, (), ()),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_number_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
def test_number_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||||
|
@ -408,12 +409,6 @@ def test_number_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||||
(
|
(
|
||||||
{}, # Must have mandatory fields
|
{}, # Must have mandatory fields
|
||||||
{"mode": "slider"}, # Must have min+max in slider mode
|
{"mode": "slider"}, # Must have min+max in slider mode
|
||||||
{
|
|
||||||
"mode": "slider",
|
|
||||||
"min": 0,
|
|
||||||
"max": 1,
|
|
||||||
"step": "any", # Can't combine slider with step any
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_number_selector_schema_error(schema) -> None:
|
def test_number_selector_schema_error(schema) -> None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue