diff --git a/packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 6ef2d20d14f8..4511497eccde 100644 --- a/packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -692,7 +692,7 @@ def test_{{ method_name }}_empty_call(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) + assert re.fullmatch(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %} @@ -730,7 +730,7 @@ def test_{{ method_name }}_non_empty_request_with_auto_populated_field(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) + assert re.fullmatch(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %} diff --git a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 index 475f9f3d3f13..9e3f4be26b13 100644 --- a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 +++ b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 @@ -151,7 +151,7 @@ def test_{{ method_name }}_non_empty_request_with_auto_populated_field(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"{{ get_uuid4_re() }}", args[0].{{ auto_populated_field }}) + assert re.fullmatch(r"{{ get_uuid4_re() }}", args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %} @@ -1224,7 +1224,7 @@ def test_{{ method_name }}_rest_required_fields(request_type={{ method.input.ide # Ensure that the uuid4 field is set according to AIP 4235 for i, (key, value) in enumerate(req.call_args.kwargs['params']): if key == "{{ auto_populated_field|camel_case }}": - assert re.match(r"{{ get_uuid4_re() }}", value) + assert re.fullmatch(r"{{ get_uuid4_re() }}", value) break # Include {{ auto_populated_field|camel_case }} within expected_params with value mock.ANY @@ -1576,7 +1576,7 @@ def test_{{ method_name }}_rest_no_http_options(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"{{ get_uuid4_re() }}", args[0].{{ auto_populated_field }}) + assert re.fullmatch(r"{{ get_uuid4_re() }}", args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %}{# for auto_populated_field in method_settings.auto_populated_fields #} diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py index c637c8f077e0..9f6d000ab291 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py @@ -1863,7 +1863,7 @@ def test_create_job_non_empty_request_with_auto_populated_field(): call.assert_called() _, args, _ = call.mock_calls[0] # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) # clear UUID field so that the check below succeeds args[0].request_id = None assert args[0] == storage_batch_operations.CreateJobRequest( @@ -2215,7 +2215,7 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): call.assert_called() _, args, _ = call.mock_calls[0] # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) # clear UUID field so that the check below succeeds args[0].request_id = None assert args[0] == storage_batch_operations.DeleteJobRequest( @@ -2533,7 +2533,7 @@ def test_cancel_job_non_empty_request_with_auto_populated_field(): call.assert_called() _, args, _ = call.mock_calls[0] # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) # clear UUID field so that the check below succeeds args[0].request_id = None assert args[0] == storage_batch_operations.CancelJobRequest( @@ -4135,7 +4135,7 @@ def test_create_job_rest_required_fields(request_type=storage_batch_operations.C # Ensure that the uuid4 field is set according to AIP 4235 for i, (key, value) in enumerate(req.call_args.kwargs['params']): if key == "requestId": - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", value) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", value) break # Include requestId within expected_params with value mock.ANY @@ -4313,7 +4313,7 @@ def test_delete_job_rest_required_fields(request_type=storage_batch_operations.D # Ensure that the uuid4 field is set according to AIP 4235 for i, (key, value) in enumerate(req.call_args.kwargs['params']): if key == "requestId": - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", value) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", value) break # Include requestId within expected_params with value mock.ANY @@ -4489,7 +4489,7 @@ def test_cancel_job_rest_required_fields(request_type=storage_batch_operations.C # Ensure that the uuid4 field is set according to AIP 4235 for i, (key, value) in enumerate(req.call_args.kwargs['params']): if key == "requestId": - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", value) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", value) break # Include requestId within expected_params with value mock.ANY @@ -5125,7 +5125,7 @@ def test_create_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) # clear UUID field so that the check below succeeds args[0].request_id = None request_msg = storage_batch_operations.CreateJobRequest() @@ -5152,7 +5152,7 @@ def test_delete_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) # clear UUID field so that the check below succeeds args[0].request_id = None request_msg = storage_batch_operations.DeleteJobRequest() @@ -5179,7 +5179,7 @@ def test_cancel_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) # clear UUID field so that the check below succeeds args[0].request_id = None request_msg = storage_batch_operations.CancelJobRequest() @@ -5330,7 +5330,7 @@ async def test_create_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) # clear UUID field so that the check below succeeds args[0].request_id = None request_msg = storage_batch_operations.CreateJobRequest() @@ -5359,7 +5359,7 @@ async def test_delete_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) # clear UUID field so that the check below succeeds args[0].request_id = None request_msg = storage_batch_operations.DeleteJobRequest() @@ -5389,7 +5389,7 @@ async def test_cancel_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) # clear UUID field so that the check below succeeds args[0].request_id = None request_msg = storage_batch_operations.CancelJobRequest() @@ -6647,7 +6647,7 @@ def test_create_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) # clear UUID field so that the check below succeeds args[0].request_id = None request_msg = storage_batch_operations.CreateJobRequest() @@ -6673,7 +6673,7 @@ def test_delete_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) # clear UUID field so that the check below succeeds args[0].request_id = None request_msg = storage_batch_operations.DeleteJobRequest() @@ -6699,7 +6699,7 @@ def test_cancel_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) # clear UUID field so that the check below succeeds args[0].request_id = None request_msg = storage_batch_operations.CancelJobRequest()