Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 7f001e5

Browse files
authored
Revert "fix: convert datetime back to proto for unit tests (#511)"
This reverts commit e1c787d.
1 parent eb4f4aa commit 7f001e5

2 files changed

Lines changed: 0 additions & 20 deletions

File tree

gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ from unittest import mock
77
import grpc
88
import math
99
import pytest
10-
from proto.marshal.rules.dates import DurationRule, TimestampRule
1110

1211
{# Import the service itself as well as every proto module that it imports. -#}
1312
{% filter sort_lines -%}
@@ -376,13 +375,7 @@ def test_{{ method.name|snake_case }}_flattened():
376375
assert len(call.mock_calls) == 1
377376
_, args, _ = call.mock_calls[0]
378377
{% for key, field in method.flattened_fields.items() -%}{%- if not field.oneof or field.proto3_optional %}
379-
{% if field.ident|string() == 'timestamp.Timestamp' -%}
380-
assert TimestampRule().to_proto(args[0].{{ key }}) == {{ field.mock_value }}
381-
{% elif field.ident|string() == 'duration.Duration' -%}
382-
assert DurationRule().to_proto(args[0].{{ key }}) == {{ field.mock_value }}
383-
{% else -%}
384378
assert args[0].{{ key }} == {{ field.mock_value }}
385-
{% endif %}
386379
{% endif %}{% endfor %}
387380
{%- for oneofs in method.flattened_oneof_fields().values() %}
388381
{%- with field = oneofs[-1] %}

gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import grpc
88
from grpc.experimental import aio
99
import math
1010
import pytest
11-
from proto.marshal.rules.dates import DurationRule, TimestampRule
1211

1312
{# Import the service itself as well as every proto module that it imports. -#}
1413
{% filter sort_lines -%}
@@ -575,13 +574,7 @@ def test_{{ method.name|snake_case }}_flattened():
575574
assert len(call.mock_calls) == 1
576575
_, args, _ = call.mock_calls[0]
577576
{% for key, field in method.flattened_fields.items() -%}{%- if not field.oneof or field.proto3_optional %}
578-
{% if field.ident|string() == 'timestamp.Timestamp' -%}
579-
assert TimestampRule().to_proto(args[0].{{ key }}) == {{ field.mock_value }}
580-
{% elif field.ident|string() == 'duration.Duration' -%}
581-
assert DurationRule().to_proto(args[0].{{ key }}) == {{ field.mock_value }}
582-
{% else -%}
583577
assert args[0].{{ key }} == {{ field.mock_value }}
584-
{% endif %}
585578
{% endif %}{% endfor %}
586579
{%- for oneofs in method.flattened_oneof_fields().values() %}
587580
{%- with field = oneofs[-1] %}
@@ -660,13 +653,7 @@ async def test_{{ method.name|snake_case }}_flattened_async():
660653
assert len(call.mock_calls)
661654
_, args, _ = call.mock_calls[0]
662655
{% for key, field in method.flattened_fields.items() -%}{%- if not field.oneof or field.proto3_optional %}
663-
{% if field.ident|string() == 'timestamp.Timestamp' -%}
664-
assert TimestampRule().to_proto(args[0].{{ key }}) == {{ field.mock_value }}
665-
{% elif field.ident|string() == 'duration.Duration' -%}
666-
assert DurationRule().to_proto(args[0].{{ key }}) == {{ field.mock_value }}
667-
{% else -%}
668656
assert args[0].{{ key }} == {{ field.mock_value }}
669-
{% endif %}
670657
{% endif %}{% endfor %}
671658
{%- for oneofs in method.flattened_oneof_fields().values() %}
672659
{%- with field = oneofs[-1] %}

0 commit comments

Comments
 (0)