def test_exceptions(self):
        """ Check incorrect types/values for properties raise exceptions """
        assoc = A_RELEASE()

        with self.assertRaises(AttributeError):
            assoc.reason = "something"

        with pytest.raises(ValueError):
            assoc.result = "accepted"
Exemple #2
0
    def CheckRelease(self):
        """Checks for release request from the remote AE. Upon reception of
        the request a confirmation is sent"""
        rel = self.dul.peek_next_pdu()
        if rel.__class__ == A_RELEASE:
            # Make sure this is a A-RELEASE request primitive
            if rel.result == 'affirmative':
                return False

            self.dul.receive_pdu(wait=False)
            release_rsp = A_RELEASE()
            release_rsp.result = "affirmative"
            self.dul.send_pdu(release_rsp)

            return True

        return False