Esempio n. 1
0
def test_invalid_payload(frame):
    """Test for having wrong payload set"""
    frame.code = CEMIMessageCode.L_DATA_IND
    frame.flags = 0
    frame.mpdu_len = 1
    frame.payload = DPTComparator()
    frame.src_addr = IndividualAddress(0)
    frame.dst_addr = IndividualAddress(0)

    with raises(TypeError):
        frame.calculated_length()

    with raises(TypeError):
        frame.to_knx()
Esempio n. 2
0
 def test_dpt_comparator_none_with_wrong_parameter(self):
     """Test comperator for DPTBinary and DPTBinary - wrong parameter."""
     with self.assertRaises(TypeError):
         DPTComparator.compare("bla", DPTBinary(0))
Esempio n. 3
0
 def test_dpt_comparator_none_with_none(self):
     """Test comperator for DPTBinary and DPTBinary - missing cases."""
     self.assertTrue(DPTComparator.compare(None, None))
     self.assertTrue(DPTComparator.compare(None, DPTBinary(0)))
     self.assertTrue(DPTComparator.compare(None, DPTArray(())))