Enhance Samsung monitor detection logic and add unit tests for trigger candidate selection
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.hardware import _select_trigger_candidate_index
|
||||
|
||||
|
||||
def test_select_trigger_candidate_by_unique_trigger_code() -> None:
|
||||
candidates = [
|
||||
("DELL U2720Q", 60),
|
||||
("Generic PnP Monitor", 19),
|
||||
]
|
||||
assert _select_trigger_candidate_index(candidates) == 1
|
||||
|
||||
|
||||
def test_select_trigger_candidate_by_generic_tiebreaker() -> None:
|
||||
candidates = [
|
||||
("DELL U2720Q", 15),
|
||||
("Generic PnP Monitor", 19),
|
||||
]
|
||||
assert _select_trigger_candidate_index(candidates) == 1
|
||||
|
||||
|
||||
def test_select_trigger_candidate_none_when_still_ambiguous() -> None:
|
||||
candidates = [
|
||||
("Generic PnP Monitor #1", 15),
|
||||
("Generic PnP Monitor #2", 19),
|
||||
]
|
||||
assert _select_trigger_candidate_index(candidates) is None
|
||||
Reference in New Issue
Block a user