コード例 #1
0
 def test_sendIntData3(self):
     self.assertEqual(apc.sendIntData({0:120.0,3:2300.0,1:2222.0,8:1,9:340.0,7:120000},s,apc.fixedPoint),True)
コード例 #2
0
 def test_controller_is_active_true(self):
     apc.sendIntData({0:10.0,6:1},s,apc.fixedPoint)
     self.assertEqual(apc.controllerIsActive,True)
コード例 #3
0
 def test_sendIntData1(self):
     self.assertEqual(apc.sendIntData({0:10.0,1:9999.0,2:120.0,3:23000.0,4:4500.0,5:4501.0,6:1,7:340,8:0,9:1200.0},s,apc.fixedPoint),True)
コード例 #4
0
 def test_sendIntData2(self):
     self.assertEqual(apc.sendIntData({2:10.0,0:120.0,3:23000.0,1:2222.0,5:45002.0,4:45001.0,8:1,9:340.0,6:0,7:1200,10:20.0},s,apc.fixedPoint),True)
コード例 #5
0
 def test_is_active_error(self):
     with self.assertRaisesRegex(KeyError,"The controller must be disabled to write an output."):
         apc.sendIntData({0:12.0,10:2.34},s,apc.fixedPoint)
コード例 #6
0
 def test_no_output(self):
     #with self.assertRaisesRegex(KeyError,"When you disable the controller (mode 6 = 0), you have to write an output (key)."):
     with self.assertRaises(KeyError):
         apc.sendIntData({0:12.0,6:0},s,apc.fixedPoint)
コード例 #7
0
 def test_direction_no_valid_int(self):
     #with self.assertRaisesRegex(ValueError,"The direction (key 8) must be either 0 for DIRECT or 1 for REVERSE."):
     with self.assertRaises(ValueError):
         apc.sendIntData({0:12.0,8:23},s,apc.fixedPoint)
コード例 #8
0
 def test_mode_no_valid_int(self):
     #with self.assertRaisesRegex(ValueError,"The mode (key 6) must be either 0 for MANUAL or 1 for AUTOMATIC."):
     with self.assertRaises(ValueError):
         apc.sendIntData({0:12.0,6:2},s,apc.fixedPoint)
コード例 #9
0
 def test_upper_limit_smaller_than_lower_limit(self):
     with self.assertRaisesRegex(ValueError,"The upper output limit must be greater than the lower output limit."):
         apc.sendIntData({0:12.0,4:234.0,5:123.0},s,apc.fixedPoint)
コード例 #10
0
 def test_direction_not_int(self):
     with self.assertRaisesRegex(TypeError,"The type of the direction must be int."):
         apc.sendIntData({0:12.0,8:23.0},s,apc.fixedPoint)
コード例 #11
0
 def test_sample_time_too_small(self):
     with self.assertRaisesRegex(ValueError,"The given sample time is -1 is invalid. It must be smaller than 4294967296 and bigger than 0."):
         apc.sendIntData({0:12.0,7:-1},s,apc.fixedPoint)