Пример #1
0
    def test_reason_str(self):
        """ Check the reaspm str returns correct values """
        pdu = A_ABORT_RQ()
        pdu.decode(a_abort)

        pdu.source = 2
        pdu.reason_diagnostic = 0
        assert pdu.reason_str == "No reason given"
        pdu.reason_diagnostic = 1
        assert pdu.reason_str == "Unrecognised PDU"
        pdu.reason_diagnostic = 2
        assert pdu.reason_str == "Unexpected PDU"
        pdu.reason_diagnostic = 3
        assert pdu.reason_str == "Reserved"
        pdu.reason_diagnostic = 4
        assert pdu.reason_str == "Unrecognised PDU parameter"
        pdu.reason_diagnostic = 5
        assert pdu.reason_str == "Unexpected PDU parameter"
        pdu.reason_diagnostic = 6
        assert pdu.reason_str == "Invalid PDU parameter value"
Пример #2
0
    def test_reason_str(self):
        """ Check the reaspm str returns correct values """
        pdu = A_ABORT_RQ()
        pdu.Decode(a_abort)

        pdu.source = 2
        pdu.reason_diagnostic = 0
        self.assertEqual(pdu.reason_str, "No reason given")
        pdu.reason_diagnostic = 1
        self.assertEqual(pdu.reason_str, "Unrecognised PDU")
        pdu.reason_diagnostic = 2
        self.assertEqual(pdu.reason_str, "Unexpected PDU")
        pdu.reason_diagnostic = 3
        self.assertEqual(pdu.reason_str, "Reserved")
        pdu.reason_diagnostic = 4
        self.assertEqual(pdu.reason_str, "Unrecognised PDU parameter")
        pdu.reason_diagnostic = 5
        self.assertEqual(pdu.reason_str, "Unexpected PDU parameter")
        pdu.reason_diagnostic = 6
        self.assertEqual(pdu.reason_str, "Invalid PDU parameter value")