def test_empty_uid_n_set(self): """Test converting N_CREATE_RQ with empty UID value.""" msg = N_SET_RQ() for data in [n_set_rq_cmd_empty]: p_data = P_DATA() p_data.presentation_data_value_list.append([0, data]) msg.decode_msg(p_data) primitive = msg.message_to_primitive() assert isinstance(primitive, N_SET) assert primitive.RequestedSOPClassUID is None assert primitive.MessageID == 7 assert primitive.RequestedSOPInstanceUID is None
def test_message_to_primitive_n_set(self): """Test converting N_SET_RQ and _RSP to primitive.""" # N-SET-RQ msg = N_SET_RQ() for data in [n_set_rq_cmd, n_set_rq_ds]: p_data = P_DATA() p_data.presentation_data_value_list.append([0, data]) msg.decode_msg(p_data) primitive = msg.message_to_primitive() assert isinstance(primitive, N_SET) assert primitive.RequestedSOPClassUID == UID( "1.2.840.10008.5.1.4.1.1.2") assert primitive.RequestedSOPInstanceUID == UID( "1.2.392.200036.9116.2.6.1.48") assert primitive.MessageID == 7 ds = decode(primitive.ModificationList, True, True) assert ds.PatientName == "Tube HeNe" assert ds.PatientID == "Test1101" # N-SET-RSP msg = N_SET_RSP() for data in [n_set_rsp_cmd, n_set_rsp_ds]: p_data = P_DATA() p_data.presentation_data_value_list.append([0, data]) msg.decode_msg(p_data) msg.decode_msg(p_data) primitive = msg.message_to_primitive() assert isinstance(primitive, N_SET) assert isinstance(primitive.AttributeList, BytesIO) assert primitive.AffectedSOPClassUID == UID("1.2.4.10") assert primitive.AffectedSOPInstanceUID == UID("1.2.4.5.7.8") assert primitive.MessageIDBeingRespondedTo == 5 assert primitive.Status == 0x0000 ds = decode(primitive.AttributeList, True, True) assert ds.PatientName == "Tube HeNe" assert ds.PatientID == "Test1101"