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_event_information(self): """Test Event.event_information.""" request = N_EVENT_REPORT() request.EventInformation = 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.event_information assert event._hash == hash(request.EventInformation) assert isinstance(ds, Dataset) assert ds.PatientName == 'TEST^Test' ds.PatientID = '1234567' assert event.event_information.PatientID == '1234567' # Test hash mismatch event._hash = None assert 'PatientID' not in event.event_information
def test_empty_dataset(self): """Test with an empty dataset-like.""" request = N_EVENT_REPORT() 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.event_information assert event._hash == hash(request.EventInformation) assert ds == Dataset() # Test in-place modification works OK ds.PatientID = "1234567" assert event.event_information.PatientID == "1234567" # Test hash mismatch event._hash = None assert "PatientID" not in event.event_information
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_event_information(self): """Test Event.event_information.""" request = N_EVENT_REPORT() request.EventInformation = 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.event_information assert event._hash == hash(request.EventInformation) assert isinstance(ds, Dataset) assert ds.PatientName == "TEST^Test" ds.PatientID = "1234567" assert event.event_information.PatientID == "1234567" # Test hash mismatch event._hash = None assert "PatientID" not in event.event_information