def test_result_str(self): """ Check the result str returns correct values """ pdu = A_ASSOCIATE_RJ() pdu.Decode(a_associate_rj) pdu.result = 0 with self.assertRaises(ValueError): pdu.result_str pdu.result = 1 self.assertEqual(pdu.result_str, 'Rejected (Permanent)') pdu.result = 2 self.assertEqual(pdu.result_str, 'Rejected (Transient)') pdu.result = 3 with self.assertRaises(ValueError): pdu.result_str
def test_result_str(self): """ Check the result str returns correct values """ pdu = A_ASSOCIATE_RJ() pdu.decode(a_associate_rj) pdu.result = 0 with pytest.raises(ValueError): pdu.result_str pdu.result = 1 assert pdu.result_str == 'Rejected (Permanent)' pdu.result = 2 assert pdu.result_str == 'Rejected (Transient)' pdu.result = 3 with pytest.raises(ValueError): pdu.result_str
def test_update_data(self): """ Check that updating the PDU data works correctly """ orig_pdu = A_ASSOCIATE_RJ() orig_pdu.Decode(a_associate_rj) orig_pdu.source = 2 orig_pdu.reason_diagnostic = 2 orig_pdu.result = 2 orig_pdu.get_length() primitive = orig_pdu.ToParams() new_pdu = A_ASSOCIATE_RJ() new_pdu.FromParams(primitive) self.assertEqual(new_pdu, orig_pdu)