本文整理匯總了Python中pytomation.devices.Motion.ignore_off方法的典型用法代碼示例。如果您正苦於以下問題:Python Motion.ignore_off方法的具體用法?Python Motion.ignore_off怎麽用?Python Motion.ignore_off使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pytomation.devices.Motion
的用法示例。
在下文中一共展示了Motion.ignore_off方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: MotionTests
# 需要導入模塊: from pytomation.devices import Motion [as 別名]
# 或者: from pytomation.devices.Motion import ignore_off [as 別名]
class MotionTests(TestCase):
def setUp(self):
self.interface = Mock()
self.interface.state = State.UNKNOWN
self.device = Motion('D1', self.interface)
def test_instantiation(self):
self.assertIsNotNone(self.device,
'Motion Device could not be instantiated')
def test_motion_motion(self):
self.assertEqual(self.device.state, State.UNKNOWN)
self.device._on_command('D1', State.ON)
self.assertEqual(self.device.state, State.MOTION)
self.device._on_command('D1', State.OFF)
self.assertEqual(self.device.state, State.STILL)
def test_motion_ignore(self):
self.device = Motion('D1', devices=(self.interface), ignore_off=True)
self.device._on_command('D1', State.ON, self.interface)
self.assertEqual(self.device.state, State.MOTION)
self.device._on_command('D1', State.OFF, self.interface)
self.assertEqual(self.device.state, State.MOTION)
# Make sure we can turn ignore off
self.device.ignore_off(False)
self.device._on_command('D1', State.OFF, self.interface)
self.assertEqual(self.device.state, State.STILL)