Пример #1
0
def test_field_discriminator() -> None:
    cost_object = models.CostClass(
        costType=models.CostTypeClass.ORG_COST_TYPE,
        cost=models.CostCostClass(
            fieldDiscriminator=models.CostCostDiscriminatorClass.costCode,
            costCode="sampleCostCode",
        ),
    )

    assert cost_object.validate()
Пример #2
0
             }
         }
     },
 ),
 (
     # Verify the behavior of the fieldDiscriminator for primitive enums.
     models.
     MetadataChangeEventClass(proposedSnapshot=models.MLModelSnapshotClass(
         urn=
         "urn:li:mlModel:(urn:li:dataPlatform:science,scienceModel,PROD)",
         aspects=[
             models.CostClass(
                 costType=models.CostTypeClass.ORG_COST_TYPE,
                 cost=models.CostCostClass(
                     fieldDiscriminator=models.
                     CostCostDiscriminatorClass.costCode,
                     costCode="sampleCostCode",
                 ),
             )
         ],
     )),
     "/entities?action=ingest",
     {
         "entity": {
             "value": {
                 "com.linkedin.metadata.snapshot.MLModelSnapshot": {
                     "urn":
                     "urn:li:mlModel:(urn:li:dataPlatform:science,scienceModel,PROD)",
                     "aspects": [{
                         "com.linkedin.common.Cost": {
                             "costType": "ORG_COST_TYPE",