예제 #1
0
 def test_to_knx_max_exceeded(self):
     """Test parsing of DPTAngle with wrong value (overflow)."""
     with self.assertRaises(ConversionError):
         DPTAngle().to_knx(361)
예제 #2
0
 def test_value_max(self):
     """Test parsing and streaming of DPTAngle 360°."""
     self.assertEqual(DPTAngle().to_knx(360), (0xFF, ))
     self.assertEqual(DPTAngle().from_knx((0xFF, )), 360)
예제 #3
0
 def test_value_min(self):
     """Test parsing and streaming of DPTAngle 0°."""
     self.assertEqual(DPTAngle().to_knx(0), (0x00, ))
     self.assertEqual(DPTAngle().from_knx((0x00, )), 0)
예제 #4
0
 def test_value_30_deg(self):
     """Test parsing and streaming of DPTAngle 30°."""
     self.assertEqual(DPTAngle().to_knx(30), (0x15, ))
     self.assertEqual(DPTAngle().from_knx((0x15, )), 30)
예제 #5
0
 def test_value_270_deg(self):
     """Test parsing and streaming of DPTAngle 270°."""
     self.assertEqual(DPTAngle().to_knx(270), (0xBF, ))
     self.assertEqual(DPTAngle().from_knx((0xBF, )), 270)
예제 #6
0
 def test_to_knx_min_exceeded(self):
     """Test parsing of DPTAngle with wrong value (underflow)."""
     with pytest.raises(ConversionError):
         DPTAngle.to_knx(-1)
예제 #7
0
 def test_value_min(self):
     """Test parsing and streaming of DPTAngle 0°."""
     assert DPTAngle.to_knx(0) == (0x00, )
     assert DPTAngle.from_knx((0x00, )) == 0
예제 #8
0
 def test_value_max(self):
     """Test parsing and streaming of DPTAngle 360°."""
     assert DPTAngle.to_knx(360) == (0xFF, )
     assert DPTAngle.from_knx((0xFF, )) == 360
예제 #9
0
 def test_value_270_deg(self):
     """Test parsing and streaming of DPTAngle 270°."""
     assert DPTAngle.to_knx(270) == (0xBF, )
     assert DPTAngle.from_knx((0xBF, )) == 270
예제 #10
0
 def test_value_30_deg(self):
     """Test parsing and streaming of DPTAngle 30°."""
     assert DPTAngle.to_knx(30) == (0x15, )
     assert DPTAngle.from_knx((0x15, )) == 30