mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[robotpy] Mirror robotpy's commands-v2 (#8369)
Project import generated by Copybara. GitOrigin-RevId: 715c8e8372d936f447f2937aab6b1a22dc619126
This commit is contained in:
30
commandsv2/src/test/python/test_startendcommand.py
Normal file
30
commandsv2/src/test/python/test_startendcommand.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import commands2
|
||||
from util import * # type: ignore
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .util import *
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def test_startEndCommandSchedule(scheduler: commands2.CommandScheduler):
|
||||
cond1 = OOBoolean(False)
|
||||
cond2 = OOBoolean(False)
|
||||
|
||||
command = commands2.StartEndCommand(
|
||||
lambda: cond1.set(True),
|
||||
lambda: cond2.set(True),
|
||||
)
|
||||
|
||||
scheduler.schedule(command)
|
||||
scheduler.run()
|
||||
|
||||
assert scheduler.isScheduled(command)
|
||||
|
||||
scheduler.cancel(command)
|
||||
|
||||
assert not scheduler.isScheduled(command)
|
||||
assert cond1 == True
|
||||
assert cond2 == True
|
||||
Reference in New Issue
Block a user