Skip to content

Commit 4f5fb4a

Browse files
committed
Fix regex
1 parent aad33c2 commit 4f5fb4a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

temporalio/nexus/_link_conversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,4 @@ def _event_type_pascal_case_to_constant_case(s: str) -> str:
152152
>>> _event_type_pascal_case_to_constant_case("NexusOperationScheduled")
153153
"NEXUS_OPERATION_SCHEDULED"
154154
"""
155-
return re.sub(r"([^\b])([A-Z])", lambda m: "_".join(m.groups()), s).upper()
155+
return re.sub(r"([A-Z])", r"_\1", s).lstrip("_").upper()

tests/nexus/test_workflow_caller.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,7 @@ def test_link_conversion_utilities():
12861286
("Ab", "AB"),
12871287
("AbCd", "AB_CD"),
12881288
("AbCddE", "AB_CDD_E"),
1289+
("ContainsAOneLetterWord", "CONTAINS_A_ONE_LETTER_WORD"),
12891290
("NexusOperationScheduled", "NEXUS_OPERATION_SCHEDULED"),
12901291
]:
12911292
assert p2c(p) == c

0 commit comments

Comments
 (0)