mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-08 20:25:26 +03:00
Fix movement weight test
This commit is contained in:
parent
5b15a75145
commit
8921255da3
@ -189,7 +189,7 @@ class PtzAutotrackConfig(FrigateBaseModel):
|
||||
timeout: int = Field(
|
||||
default=10, title="Seconds to delay before returning to preset."
|
||||
)
|
||||
movement_weights: Optional[Union[str, List[float]]] = Field(
|
||||
movement_weights: Optional[Union[str, List[str]]] = Field(
|
||||
default=[],
|
||||
title="Internal value used for PTZ movements based on the speed of your camera's motor.",
|
||||
)
|
||||
@ -204,9 +204,9 @@ class PtzAutotrackConfig(FrigateBaseModel):
|
||||
return None
|
||||
|
||||
if isinstance(v, str):
|
||||
weights = list(map(float, v.split(",")))
|
||||
weights = list(map(str, map(float, v.split(","))))
|
||||
elif isinstance(v, list):
|
||||
weights = [float(val) for val in v]
|
||||
weights = [str(val) for val in v]
|
||||
else:
|
||||
raise ValueError("Invalid type for movement_weights")
|
||||
|
||||
|
||||
@ -1535,11 +1535,11 @@ class TestConfig(unittest.TestCase):
|
||||
|
||||
runtime_config = frigate_config.runtime_config()
|
||||
assert runtime_config.cameras["back"].onvif.autotracking.movement_weights == [
|
||||
0.0,
|
||||
1.0,
|
||||
1.23,
|
||||
2.34,
|
||||
0.5,
|
||||
"0.0",
|
||||
"1.0",
|
||||
"1.23",
|
||||
"2.34",
|
||||
"0.5",
|
||||
]
|
||||
|
||||
def test_fails_invalid_movement_weights(self):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user