mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[copybara] Sync with mostrobotpy (#8820)
GitOrigin-RevId: f03f29e57af22a74b680873090028b9c9f5c8063
This commit is contained in:
@@ -18,11 +18,7 @@ def group_name(request):
|
||||
|
||||
|
||||
def get_active_alerts(level: Alert.Level) -> T.List[str]:
|
||||
return [
|
||||
a.text
|
||||
for a in AlertSim.getAll()
|
||||
if a.level == level and a.isActive()
|
||||
]
|
||||
return [a.text for a in AlertSim.getAll() if a.level == level and a.isActive()]
|
||||
|
||||
|
||||
def is_alert_active(text: str, level: Alert.Level):
|
||||
@@ -144,6 +140,7 @@ def test_set_text_while_set(group_name):
|
||||
assert not is_alert_active("BEFORE", Alert.Level.LOW)
|
||||
assert is_alert_active("AFTER", Alert.Level.LOW)
|
||||
|
||||
|
||||
def test_get_active(group_name):
|
||||
with (
|
||||
Alert(group_name, "A", Alert.Level.HIGH) as a,
|
||||
@@ -154,10 +151,10 @@ def test_get_active(group_name):
|
||||
a.set(True)
|
||||
b.set(True)
|
||||
c.set(False)
|
||||
|
||||
|
||||
active = AlertSim.getActive()
|
||||
allAlerts = AlertSim.getAll()
|
||||
|
||||
|
||||
assert len(active) == 2
|
||||
assert len(allAlerts) == 3
|
||||
|
||||
@@ -169,4 +166,4 @@ def test_get_active(group_name):
|
||||
allAlerts = AlertSim.getAll()
|
||||
assert len(active) == 1
|
||||
assert len(allAlerts) == 3
|
||||
assert active[0].text == "B"
|
||||
assert active[0].text == "B"
|
||||
|
||||
Reference in New Issue
Block a user