Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: convert datetime back to proto for unit tests #511

Merged
merged 1 commit into from Jul 10, 2020

Conversation

busunkim96
Copy link
Contributor

@busunkim96 busunkim96 commented Jul 10, 2020

Closes #508

field.mock_value (passed to the request) is a protobuf timestamp/duration, but the call gets a datetime/timedelta object. From Type Marshaling this seems to be the expected behavior.

Proto Plus provides a service that converts between protocol buffer objects and native Python types (or the wrapper > types provided by this library).

This allows native Python objects to be used in place of protocol buffer messages where appropriate. In all cases, we return the native type, and are liberal on what we accept.

I tried protobuf's ToDatetime() but the resulting datetime doesn't have tzinfo. https://googleapis.dev/python/protobuf/latest/google/protobuf/timestamp_pb2.html#google.protobuf.timestamp_pb2.Timestamp.ToDatetime

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 10, 2020
@codecov
Copy link

codecov bot commented Jul 10, 2020

Codecov Report

Merging #511 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #511   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines         1502      1502           
  Branches       308       308           
=========================================
  Hits          1502      1502           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c7c63f2...2cfb029. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unit tests with timestamps fail
3 participants