Update tests/test_utils_get_adj.py
Run CI Tests / test (push) Successful in 51s

This commit is contained in:
2025-07-31 22:14:09 +02:00
parent 172342c0ae
commit 6f8c7220dd
+11 -15
View File
@@ -47,32 +47,28 @@ class SubAdjustable(Adjustable):
def real_adjustables():
a1 = SubAdjustable("brightness", units="%", limit_low=0, limit_high=100)
a2 = SubAdjustable("contrast", units="%", limit_low=0, limit_high=100)
a3 = SubAdjustable("debug_internal", internal=True)
return a1, a2, a3
a3 = SubAdjustable("mid_contrast", units="%", limit_low=0, limit_high=100)
a4 = SubAdjustable("mid_brightness", units="%", limit_low=0, limit_high=100)
a5 = SubAdjustable("debug_internal", internal=True)
return a1, a2, a3, a4, a5
def test_get_adj_success(real_adjustables):
a1, _, _ = real_adjustables
a1, _, _, _, _ = real_adjustables
assert get_adj("brightness") is a1
unregister_adj([a1])
def test_get_adj_not_found(capfd):
with pytest.raises(ValueError, match='could not find Adjustable with name "nonexistent"') as exc_info:
get_adj("nonexistent")
def test_ensure_adjs_mixed(real_adjustables):
a1, a2, a3 = real_adjustables
result = ensure_adjs(["contrast", a1, "debug_internal"])
assert result == (a2, a1, a3)
unregister_adj([a1, a2, a3])
_, a2, a3, _, _ = real_adjustables
result = ensure_adjs([a3, "contrast"])
assert result == (a3, a2)
def test_get_adjs_filter(real_adjustables):
a1, a2, a3 = real_adjustables
_, _, _, a4, a5 = real_adjustables
public = get_adjs()
assert public == {"brightness": a1, "contrast": a2}
assert public == {"brightness": a1, "contrast": a2, "mid_contrast": a3, "mid_brightness": a4}
all_ = get_adjs(include_internal=True)
assert all_ == {"brightness": a1, "contrast": a2, "debug_internal": a3}
unregister_adj([a1, a2, a3])
assert public == {"brightness": a1, "contrast": a2, "mid_contrast": a3, "mid_brightness": a4, "debug_internal": a5}