File tree Expand file tree Collapse file tree
packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -402,6 +402,8 @@ def test_{{ method_name }}_flattened():
402402 assert DurationRule().to_proto(args[0].{{ key }}) == {{ field.mock_value }}
403403 {% elif (field .ident |string ()).startswith ('wrappers_pb2.' ) %}
404404 assert wrappers.{{ (field.ident|string())[13:] }}Rule().to_proto(args[0].{{ key }}) == {{ field.mock_value }}
405+ {% elif field .field_pb .type == 2 %} {# Use approx eq for floats #}
406+ assert math.isclose(args[0].{{ field.name }}, {{ field.mock_value }}, rel_tol=1e-6)
405407 {% else %}
406408 arg = args[0].{{ key }}
407409 mock_val = {{ field.mock_value }}
@@ -497,6 +499,8 @@ async def test_{{ method_name }}_flattened_async():
497499 assert DurationRule().to_proto(args[0].{{ key }}) == {{ field.mock_value }}
498500 {% elif (field .ident |string ()).startswith ('wrappers_pb2.' ) %}
499501 assert wrappers.{{ (field.ident|string())[13:] }}Rule().to_proto(args[0].{{ key }}) == {{ field.mock_value }}
502+ {% elif field .field_pb .type == 2 %} {# Use approx eq for floats #}
503+ assert math.isclose(args[0].{{ field.name }}, {{ field.mock_value }}, rel_tol=1e-6)
500504 {% else %}
501505 arg = args[0].{{ key }}
502506 mock_val = {{ field.mock_value }}
You can’t perform that action at this time.
0 commit comments