Add pet detection, wildlife, and activity config models
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Tests for config loading and validation."""
|
||||
|
||||
from vigilar.config import CameraConfig, VigilarConfig
|
||||
from vigilar.config import PetsConfig, WildlifeThreatMap, WildlifeSizeHeuristics, PetActivityConfig
|
||||
|
||||
|
||||
def test_default_config():
|
||||
@@ -33,3 +34,61 @@ def test_camera_sensitivity_bounds():
|
||||
import pytest
|
||||
with pytest.raises(Exception):
|
||||
CameraConfig(id="test", display_name="Test", rtsp_url="rtsp://localhost", motion_sensitivity=1.5)
|
||||
|
||||
|
||||
class TestPetsConfig:
|
||||
def test_defaults(self):
|
||||
cfg = PetsConfig()
|
||||
assert cfg.enabled is False
|
||||
assert cfg.model == "yolov8s"
|
||||
assert cfg.confidence_threshold == 0.5
|
||||
assert cfg.pet_id_threshold == 0.7
|
||||
assert cfg.pet_id_low_confidence == 0.5
|
||||
assert cfg.min_training_images == 20
|
||||
assert cfg.crop_retention_days == 7
|
||||
|
||||
def test_custom_values(self):
|
||||
cfg = PetsConfig(enabled=True, model="yolov8m", confidence_threshold=0.6)
|
||||
assert cfg.enabled is True
|
||||
assert cfg.model == "yolov8m"
|
||||
assert cfg.confidence_threshold == 0.6
|
||||
|
||||
|
||||
class TestWildlifeThreatMap:
|
||||
def test_defaults(self):
|
||||
tm = WildlifeThreatMap()
|
||||
assert "bear" in tm.predator
|
||||
assert "bird" in tm.passive
|
||||
|
||||
def test_custom_mapping(self):
|
||||
tm = WildlifeThreatMap(predator=["bear", "wolf"], nuisance=["raccoon"])
|
||||
assert "wolf" in tm.predator
|
||||
assert "raccoon" in tm.nuisance
|
||||
|
||||
|
||||
class TestWildlifeSizeHeuristics:
|
||||
def test_defaults(self):
|
||||
sh = WildlifeSizeHeuristics()
|
||||
assert sh.small == 0.02
|
||||
assert sh.medium == 0.08
|
||||
assert sh.large == 0.15
|
||||
|
||||
|
||||
class TestPetActivityConfig:
|
||||
def test_defaults(self):
|
||||
cfg = PetActivityConfig()
|
||||
assert cfg.daily_digest is True
|
||||
assert cfg.highlight_clips is True
|
||||
assert cfg.zoomie_threshold == 0.8
|
||||
|
||||
|
||||
class TestCameraConfigLocation:
|
||||
def test_default_location_is_interior(self):
|
||||
from vigilar.config import CameraConfig
|
||||
cfg = CameraConfig(id="test", display_name="Test", rtsp_url="rtsp://x")
|
||||
assert cfg.location == "INTERIOR"
|
||||
|
||||
def test_exterior_location(self):
|
||||
from vigilar.config import CameraConfig
|
||||
cfg = CameraConfig(id="test", display_name="Test", rtsp_url="rtsp://x", location="EXTERIOR")
|
||||
assert cfg.location == "EXTERIOR"
|
||||
|
||||
Reference in New Issue
Block a user