From f48e3901c65097644e4ae34e21aa10c4fca925b2 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Fri, 1 Jul 2022 14:37:34 +0200 Subject: [PATCH 1/2] test(parser): failing test --- package-parser/tests/data/enums/annotation_data.json | 12 ++++++++++++ package-parser/tests/data/enums/api_data.json | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/package-parser/tests/data/enums/annotation_data.json b/package-parser/tests/data/enums/annotation_data.json index f9a8ada86..90be550f8 100644 --- a/package-parser/tests/data/enums/annotation_data.json +++ b/package-parser/tests/data/enums/annotation_data.json @@ -54,5 +54,17 @@ "stringValue": "l2" } ] + }, + "test/test/some_global_function/issue_858": { + "target": "test/test/some_global_function/issue_858", + "authors": ["$autogen$"], + "reviewers": [], + "enumName": "Issue858", + "pairs": [ + { + "instanceName": "SAMME_R", + "stringValue": "SAMME.R" + } + ] } } diff --git a/package-parser/tests/data/enums/api_data.json b/package-parser/tests/data/enums/api_data.json index 7be0f532f..09aff082c 100644 --- a/package-parser/tests/data/enums/api_data.json +++ b/package-parser/tests/data/enums/api_data.json @@ -52,6 +52,7 @@ } }, { + "issue": "https://github.com/lars-reimann/api-editor/issues/760", "id": "test/test/some_global_function/issue_760", "name": "issue_760", "qname": "test.some_global_function.issue_760", @@ -59,6 +60,16 @@ "type": "{'l1', 'l2'}, default=None", "description": "" } + }, + { + "issue": "https://github.com/lars-reimann/api-editor/issues/858", + "id": "test/test/some_global_function/issue_858", + "name": "issue_858", + "qname": "test.some_global_function.issue_858", + "docstring": { + "type": "{'SAMME.R'}", + "description": "" + } } ] } From b2e72a6693e0df63737fe3f48054a43fbe7dd2de Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Fri, 1 Jul 2022 14:40:35 +0200 Subject: [PATCH 2/2] feat(parser): replace dots with underscores for enum instance names --- .../processing/annotations/_generate_enum_annotations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-parser/package_parser/processing/annotations/_generate_enum_annotations.py b/package-parser/package_parser/processing/annotations/_generate_enum_annotations.py index d5ae11138..f70e8fa2a 100644 --- a/package-parser/package_parser/processing/annotations/_generate_enum_annotations.py +++ b/package-parser/package_parser/processing/annotations/_generate_enum_annotations.py @@ -65,7 +65,7 @@ def _enum_name(parameter_name: str) -> str: def _enum_instance_name(string_value: str) -> str: - segments = re.split(r"[_-]", string_value) + segments = re.split(r"[_\-.]", string_value) result = "_".join( re.sub(r"\W", "", segment).upper()