def testAreSameMessageType_withDifferentMessageType_returnsFalse(self): """Test are_same_message_type with two different message types.""" patient = patient_pb2.Patient() uscore_patient_profile = uscore_pb2.USCorePatientProfile() self.assertFalse( proto_utils.are_same_message_type(patient.DESCRIPTOR, uscore_patient_profile.DESCRIPTOR)) self.assertFalse( proto_utils.are_same_message_type(patient_pb2.Patient.DESCRIPTOR, uscore_patient_profile.DESCRIPTOR))
def testIsProfileOf_withValidProfile_returnsTrue(self): """Tests is_profile_of functionality with a valid Patient profile.""" patient = patient_pb2.Patient() uscore_patient_profile = uscore_pb2.USCorePatientProfile() self.assertTrue( annotation_utils.is_profile_of(patient, uscore_patient_profile)) self.assertTrue( annotation_utils.is_profile_of(patient.DESCRIPTOR, uscore_patient_profile)) self.assertTrue( annotation_utils.is_profile_of(patient, uscore_patient_profile.DESCRIPTOR)) self.assertTrue( annotation_utils.is_profile_of(patient.DESCRIPTOR, uscore_patient_profile.DESCRIPTOR))
def testGetFhirVersion_withValidInput_returnsCorrectVersion(self): """Tests get_fhir_version to ensure that the correct version is returned.""" patient = patient_pb2.Patient() uscore_patient = uscore_pb2.USCorePatientProfile() self.assertEqual( annotation_utils.get_fhir_version(patient), _R4_FHIR_VERSION) self.assertEqual( annotation_utils.get_fhir_version(uscore_patient), _R4_FHIR_VERSION) self.assertEqual( annotation_utils.get_fhir_version(patient.DESCRIPTOR), _R4_FHIR_VERSION) self.assertEqual( annotation_utils.get_fhir_version(uscore_patient.DESCRIPTOR), _R4_FHIR_VERSION) self.assertEqual( annotation_utils.get_fhir_version(patient.DESCRIPTOR.file), _R4_FHIR_VERSION) self.assertEqual( annotation_utils.get_fhir_version(uscore_patient.DESCRIPTOR.file), _R4_FHIR_VERSION)
def testIsTypeOrProfileOfPatient_withPatientProfile_returnsTrue(self): """Tests that IsTypeOfProfileOfPatient returns True for Patient profile.""" self.assertTrue( fhir_types.is_type_or_profile_of_patient( uscore_pb2.USCorePatientProfile()))