async def test_compose_model_transform(self, client, formrecognizer_storage_container_sas_url): raw_response = [] def callback(response, _, headers): op_response = client._deserialize(GetOperationResponse, response) model_info = client._deserialize(ModelInfo, op_response.result) document_model = DocumentModel._from_generated(model_info) raw_response.append(model_info) raw_response.append(document_model) async with client: poller = await client.begin_build_model(formrecognizer_storage_container_sas_url, description="model1") model_1 = await poller.result() poller = await client.begin_build_model(formrecognizer_storage_container_sas_url, description="model2") model_2 = await poller.result() poller = await client.begin_create_composed_model([model_1.model_id, model_2.model_id], description="my composed model", cls=callback) model = await poller.result() generated = raw_response[0] document_model = raw_response[1] self.assertModelTransformCorrect(document_model, generated) document_model_dict = document_model.to_dict() document_model_from_dict = DocumentModel.from_dict(document_model_dict) self.assertModelTransformCorrect(document_model_from_dict, generated)
async def test_compose_model_transform(self, client, formrecognizer_storage_container_sas_url, **kwargs): # this can be reverted to set_bodiless_matcher() after tests are re-recorded and don't contain these headers set_custom_default_matcher( compare_bodies=False, excluded_headers="Authorization,Content-Length,x-ms-client-request-id,x-ms-request-id" ) raw_response = [] def callback(response, _, headers): op_response = client._deserialize(GetOperationResponse, response) model_info = client._deserialize(ModelInfo, op_response.result) document_model = DocumentModel._from_generated(model_info) raw_response.append(model_info) raw_response.append(document_model) async with client: poller = await client.begin_build_model(formrecognizer_storage_container_sas_url, "template", description="model1") model_1 = await poller.result() poller = await client.begin_build_model(formrecognizer_storage_container_sas_url, "template", description="model2") model_2 = await poller.result() poller = await client.begin_create_composed_model([model_1.model_id, model_2.model_id], description="my composed model", cls=callback) model = await poller.result() generated = raw_response[0] document_model = raw_response[1] self.assertModelTransformCorrect(document_model, generated) document_model_dict = document_model.to_dict() document_model_from_dict = DocumentModel.from_dict(document_model_dict) self.assertModelTransformCorrect(document_model_from_dict, generated)