本文整理汇总了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)