Exemple #1
0
 def test_from_knx_wrong_parameter2(self):
     """Test parsing of DPTSceneNumber with wrong value (array containing string)."""
     with self.assertRaises(ConversionError):
         DPTSceneNumber().from_knx(("0x23"))
Exemple #2
0
 def test_from_knx_wrong_parameter(self):
     """Test parsing of DPTSceneNumber with wrong value (3 byte array)."""
     with self.assertRaises(ConversionError):
         DPTSceneNumber().from_knx((0x01, 0x02, 0x03))
Exemple #3
0
 def test_from_knx_wrong_value(self):
     """Test parsing of DPTSceneNumber with value which exceeds limits."""
     with self.assertRaises(ConversionError):
         DPTSceneNumber().from_knx((0x64, ))
Exemple #4
0
 def test_to_knx_wrong_parameter(self):
     """Test parsing of DPTSceneNumber with wrong value (string)."""
     with self.assertRaises(ConversionError):
         DPTSceneNumber().to_knx("fnord")
Exemple #5
0
 def test_to_knx_max_exceeded(self):
     """Test parsing of DPTSceneNumber with wrong value (overflow)."""
     with self.assertRaises(ConversionError):
         DPTSceneNumber().to_knx(DPTSceneNumber.value_max + 1)
Exemple #6
0
 def test_value_min(self):
     """Test parsing and streaming of DPTSceneNumber 0."""
     self.assertEqual(DPTSceneNumber().to_knx(1), (0x00, ))
     self.assertEqual(DPTSceneNumber().from_knx((0x00, )), 1)
Exemple #7
0
 def test_value_max(self):
     """Test parsing and streaming of DPTSceneNumber 64."""
     self.assertEqual(DPTSceneNumber().to_knx(64), (0x3F, ))
     self.assertEqual(DPTSceneNumber().from_knx((0x3F, )), 64)
Exemple #8
0
 def test_value_50(self):
     """Test parsing and streaming of DPTSceneNumber 50."""
     self.assertEqual(DPTSceneNumber().to_knx(50), (0x31, ))
     self.assertEqual(DPTSceneNumber().from_knx((0x31, )), 50)