コード例 #1
0
 def test_str2bool(self):
     """Test return code from utils.str2bool."""
     self.assertTrue(str2bool('y'))
     self.assertTrue(str2bool('Y'))
     self.assertTrue(str2bool('yes'))
     self.assertTrue(str2bool(1))
     self.assertFalse(str2bool('n'))
     self.assertFalse(str2bool('N'))
     self.assertFalse(str2bool('no'))
     self.assertFalse(str2bool(0))
     self.assertTrue(str2bool(u'Y'))
     self.assertRaises(ValueError, str2bool, 'amcrest')
コード例 #2
0
 def test_str2bool(self):
     """Test return code from utils.str2bool."""
     self.assertTrue(str2bool('y'))
     self.assertTrue(str2bool('Y'))
     self.assertTrue(str2bool('yes'))
     self.assertTrue(str2bool(1))
     self.assertFalse(str2bool('n'))
     self.assertFalse(str2bool('N'))
     self.assertFalse(str2bool('no'))
     self.assertFalse(str2bool(0))
     self.assertTrue(str2bool(u'Y'))
     self.assertRaises(ValueError, str2bool, 'amcrest')
コード例 #3
0
 async def async_is_record_on_motion_detection(self,
                                               *,
                                               channel: int = 0) -> bool:
     ret = await self.async_motion_detection
     status = [pretty(s) for s in ret.split()
               if ".RecordEnable=" in s][channel]
     return str2bool(status)
コード例 #4
0
 def is_record_on_motion_detection(self):
     ret = self.motion_detection
     status = [s for s in ret.split() if '.RecordEnable=' in s][0]\
         .split('=')[-1]
     return str2bool(status)  # pylint: disable=no-value-for-parameter
コード例 #5
0
 def is_motion_detector_on(self, *, channel: int = 0) -> bool:
     ret = self.motion_detection
     status = [pretty(s) for s in ret.split() if ".Enable=" in s][channel]
     return str2bool(status)