From f64f4f4de0b4f0bb1e411907f239dfff27187f56 Mon Sep 17 00:00:00 2001 From: David Buckman Date: Sat, 1 Jul 2023 16:07:58 -0400 Subject: [PATCH 1/2] SupportedRegion as a StrEnum --- src/firebase_functions/options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/firebase_functions/options.py b/src/firebase_functions/options.py index d0dc9c0..3dec22b 100644 --- a/src/firebase_functions/options.py +++ b/src/firebase_functions/options.py @@ -89,7 +89,7 @@ class MemoryOption(int, _enum.Enum): GB_32 = 32 << 10 -class SupportedRegion(str, _enum.Enum): +class SupportedRegion(_enum.StrEnum): """ All regions supported by Cloud Functions (2nd gen). """ From baed9ed6de2c8f864d981bc66121303ade6e8280 Mon Sep 17 00:00:00 2001 From: David Buckman Date: Mon, 10 Jul 2023 19:46:36 -0400 Subject: [PATCH 2/2] Include unit tests --- tests/test_options.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_options.py b/tests/test_options.py index 4c2913a..44e5dfb 100644 --- a/tests/test_options.py +++ b/tests/test_options.py @@ -217,3 +217,11 @@ def test_merge_apis_duplicate_apis(): for actual_item in merged_apis: assert (actual_item in expected_output ), f"Unexpected item {actual_item} found in the merged list" + +def test_supported_region_enum_uses_str_representation(): + """ + Test SupportedRegion enum values are converted to their + string values for representation. + """ + assert options.SupportedRegion.US_CENTRAL1 == "us-central1" + assert f"{options.SupportedRegion.US_CENTRAL1}" == "us-central1"