-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add support for repeated keys in result protos #5907
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, but I have a few small questions/comments to resolve.
// | ||
// The bytes in this field are constructed as follows: | ||
// | ||
// 1. The results of the measurements produce a list of bits ordered by | ||
// the round of repetition. | ||
// the round of repetition and instance within a round. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice any tests that confirm this behavior. Can you add them or point me to them? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see tests that you can serialize and deserialize with the expected result, but not that the serialization follows the contract listed in this proto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM % some more test comments :-). Approving since I'm out after today and you should have the gist.
// | ||
// The bytes in this field are constructed as follows: | ||
// | ||
// 1. The results of the measurements produce a list of bits ordered by | ||
// the round of repetition. | ||
// the round of repetition and instance within a round. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see tests that you can serialize and deserialize with the expected result, but not that the serialization follows the contract listed in this proto.
assert isinstance(proto, v2.result_pb2.Result) | ||
assert len(proto.sweep_results) == 2 | ||
deserialized = v2.results_from_proto(proto, measurements) | ||
assert len(deserialized) == 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to test behavior independently rather than rolling many separate assertions into one monolithic test.
go/unit-testing-practices#behavior-testing-examples
This is a first step toward supporting repeated keys in circuits run through quantum engine. I need to expand the tests to cover cases where instances > 1, but the main logic is ready for review.