From f6d16f364c693e1a2e0915f621caac47e16bf8e2 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Mon, 28 Jun 2021 14:01:31 -0700 Subject: [PATCH 1/2] fix statistics type for healthcare --- .../azure-ai-textanalytics/azure/ai/textanalytics/_models.py | 2 +- .../azure-ai-textanalytics/tests/test_analyze_healthcare.py | 4 ++-- .../tests/test_analyze_healthcare_async.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py index 3c11af809158..e80526f5d0ff 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py @@ -496,7 +496,7 @@ def _from_generated(cls, healthcare_result): entities=entities, entity_relations=relations, warnings=healthcare_result.warnings, - statistics=healthcare_result.statistics, + statistics=TextDocumentStatistics._from_generated(healthcare_result.statistics), # pylint: disable=protected-access ) def __repr__(self): diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare.py index 9bdc344260ee..b4ccdfba9769 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare.py @@ -152,8 +152,8 @@ def callback(resp): if doc.is_error: num_error += 1 continue - assert doc.statistics.characters_count - assert doc.statistics.transactions_count + assert doc.statistics.character_count + assert doc.statistics.transaction_count assert num_error == 1 @TextAnalyticsPreparer() diff --git a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare_async.py b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare_async.py index 239bf5e9487f..e22c034c133a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare_async.py +++ b/sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare_async.py @@ -171,8 +171,8 @@ def callback(resp): if doc.is_error: num_error += 1 continue - assert doc.statistics.characters_count - assert doc.statistics.transactions_count + assert doc.statistics.character_count + assert doc.statistics.transaction_count assert num_error == 1 @TextAnalyticsPreparer() From 685026ff82fa608b3a84da0befec02df8b86c03d Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Mon, 28 Jun 2021 14:07:06 -0700 Subject: [PATCH 2/2] also fix healthcare type for warnings --- .../azure-ai-textanalytics/azure/ai/textanalytics/_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py index e80526f5d0ff..2654ef4d0449 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py +++ b/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py @@ -495,7 +495,7 @@ def _from_generated(cls, healthcare_result): id=healthcare_result.id, entities=entities, entity_relations=relations, - warnings=healthcare_result.warnings, + warnings=[TextAnalyticsWarning._from_generated(w) for w in healthcare_result.warnings], # pylint: disable=protected-access statistics=TextDocumentStatistics._from_generated(healthcare_result.statistics), # pylint: disable=protected-access )