38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from cmvr_edge_ai.application import create_default_capability_registry
|
||
|
|
from cmvr_edge_ai.capabilities import ServingMode
|
||
|
|
|
||
|
|
|
||
|
|
def test_default_capabilities_keep_public_categories_separate_from_model_ids() -> None:
|
||
|
|
registry = create_default_capability_registry(discover_entry_points=False)
|
||
|
|
|
||
|
|
mobile = registry.resolve("yolov8n-mobile-phone@1")
|
||
|
|
phone_use = registry.resolve("people-talking-yolov8x@1")
|
||
|
|
assert mobile.category == "detect.mobile_phone"
|
||
|
|
assert phone_use.category == "detect.phone_use"
|
||
|
|
assert mobile.family == "detect"
|
||
|
|
assert mobile.input_kinds == ("image",)
|
||
|
|
assert mobile.output_kinds == ("detections",)
|
||
|
|
assert ServingMode.ACTIVE_PUSH in mobile.serving_modes
|
||
|
|
assert ServingMode.PASSIVE_INVOKE in mobile.serving_modes
|
||
|
|
|
||
|
|
|
||
|
|
def test_default_capability_catalog_has_both_serving_mode_groups() -> None:
|
||
|
|
registry = create_default_capability_registry(discover_entry_points=False)
|
||
|
|
catalog = registry.build_catalog()
|
||
|
|
|
||
|
|
assert {item.category for item in catalog.active_push} == {
|
||
|
|
"detect.mobile_phone",
|
||
|
|
"detect.phone_use",
|
||
|
|
"detect.ppe",
|
||
|
|
"detect.ppe_6classes",
|
||
|
|
}
|
||
|
|
assert {item.category for item in catalog.passive_invoke} == {
|
||
|
|
"detect.mobile_phone",
|
||
|
|
"detect.phone_use",
|
||
|
|
"detect.ppe",
|
||
|
|
"detect.ppe_6classes",
|
||
|
|
"gauge.analog",
|
||
|
|
}
|