Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 8a401d4

Browse files
authored
feat(parser): replace dots with underscores for enum instance names (#866)
* test(parser): failing test * feat(parser): replace dots with underscores for enum instance names
1 parent f31c8bd commit 8a401d4

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

package-parser/package_parser/processing/annotations/_generate_enum_annotations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _enum_name(parameter_name: str) -> str:
6565

6666

6767
def _enum_instance_name(string_value: str) -> str:
68-
segments = re.split(r"[_-]", string_value)
68+
segments = re.split(r"[_\-.]", string_value)
6969

7070
result = "_".join(
7171
re.sub(r"\W", "", segment).upper()

package-parser/tests/data/enums/annotation_data.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,17 @@
5454
"stringValue": "l2"
5555
}
5656
]
57+
},
58+
"test/test/some_global_function/issue_858": {
59+
"target": "test/test/some_global_function/issue_858",
60+
"authors": ["$autogen$"],
61+
"reviewers": [],
62+
"enumName": "Issue858",
63+
"pairs": [
64+
{
65+
"instanceName": "SAMME_R",
66+
"stringValue": "SAMME.R"
67+
}
68+
]
5769
}
5870
}

package-parser/tests/data/enums/api_data.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,24 @@
5252
}
5353
},
5454
{
55+
"issue": "https://github.com/lars-reimann/api-editor/issues/760",
5556
"id": "test/test/some_global_function/issue_760",
5657
"name": "issue_760",
5758
"qname": "test.some_global_function.issue_760",
5859
"docstring": {
5960
"type": "{'l1', 'l2'}, default=None",
6061
"description": ""
6162
}
63+
},
64+
{
65+
"issue": "https://github.com/lars-reimann/api-editor/issues/858",
66+
"id": "test/test/some_global_function/issue_858",
67+
"name": "issue_858",
68+
"qname": "test.some_global_function.issue_858",
69+
"docstring": {
70+
"type": "{'SAMME.R'}",
71+
"description": ""
72+
}
6273
}
6374
]
6475
}

0 commit comments

Comments
 (0)