def test_message_id(self):
        """Test Event.modification_list."""
        request = N_SET()
        request.MessageID = 1234
        event = Event(None, evt.EVT_N_CREATE, {
            'request': request,
            'context': self.context.as_tuple
        })

        assert 1234 == event.message_id
    def test_modification_list(self):
        """Test Event.modification_list."""
        request = N_SET()
        request.ModificationList = self.bytestream
        event = Event(None, evt.EVT_N_CREATE, {
            'request': request,
            'context': self.context.as_tuple
        })

        assert event._hash is None
        assert event._decoded is None
        ds = event.modification_list
        assert event._hash == hash(request.ModificationList)
        assert isinstance(ds, Dataset)
        assert ds.PatientName == 'TEST^Test'

        ds.PatientID = '1234567'
        assert event.modification_list.PatientID == '1234567'

        # Test hash mismatch
        event._hash = None
        assert 'PatientID' not in event.modification_list
    def test_modification_list(self):
        """Test Event.modification_list."""
        request = N_SET()
        request.ModificationList = self.bytestream
        event = Event(
            None,
            evt.EVT_N_CREATE,
            {"request": request, "context": self.context.as_tuple},
        )

        assert event._hash is None
        assert event._decoded is None
        ds = event.modification_list
        assert event._hash == hash(request.ModificationList)
        assert isinstance(ds, Dataset)
        assert ds.PatientName == "TEST^Test"

        ds.PatientID = "1234567"
        assert event.modification_list.PatientID == "1234567"

        # Test hash mismatch
        event._hash = None
        assert "PatientID" not in event.modification_list