Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
331 stars 100 forks source link

fix: enable missed return types for generic #1485

Closed hallvictoria closed 1 month ago

hallvictoria commented 2 months ago

Description

Implicit output is now enabled for generic bindings, so the worker needs to support returning the same python types as it did when implicit output wasn't enabled. The other types that have been returned include:

TypedData only supports string, json, bytes, stream, http, int, double, collection types, and model_binding_data. Therefore, types that are not supported (dict, list, bool), are converted to supported types (json, json, int respectively).

Added E2E tests for all supported return types to check if the functions are executing correctly and unit tests to test the return values.

Fixes #


PR information

Quality of Code and Contribution Guidelines

codecov-commenter commented 2 months ago

Codecov Report

Attention: Patch coverage is 0% with 20 lines in your changes are missing coverage. Please review.

Project coverage is 44.55%. Comparing base (cd13c6a) to head (8359a44). Report is 1 commits behind head on dev.

:exclamation: Current head 8359a44 differs from pull request most recent head 419d951

Please upload reports for the commit 419d951 to get more accurate results.

Files Patch % Lines
azure_functions_worker/bindings/datumdef.py 0.00% 10 Missing :warning:
azure_functions_worker/bindings/generic.py 0.00% 10 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #1485 +/- ## =========================================== + Coverage 31.65% 44.55% +12.90% =========================================== Files 36 36 Lines 2306 2325 +19 Branches 336 346 +10 =========================================== + Hits 730 1036 +306 + Misses 1574 1206 -368 - Partials 2 83 +81 ``` | [Flag](https://app.codecov.io/gh/Azure/azure-functions-python-worker/pull/1485/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/Azure/azure-functions-python-worker/pull/1485/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) | `44.55% <0.00%> (+12.90%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.