Skip to content

Commit 80f8ef2

Browse files
committed
test(api-core): add test case verifying UUID_REGEX strictness
1 parent b62e121 commit 80f8ef2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/google-api-core/tests/unit/gapic/test_requests.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,9 @@ def test_setup_request_id(request_obj, is_proto3_optional, expected):
113113
assert re.fullmatch(UUID_REGEX, value)
114114
else:
115115
assert value == expected
116+
117+
118+
def test_uuid_regex_rejects_trailing_garbage():
119+
# Verify that UUID_REGEX with re.fullmatch rejects trailing characters
120+
invalid_uuid = "12345678-1234-4123-8123-123456789012_extra"
121+
assert re.fullmatch(UUID_REGEX, invalid_uuid) is None

0 commit comments

Comments
 (0)