Skip to content

Commit

Permalink
Fix test failure on differing precision of float in proto string
Browse files Browse the repository at this point in the history
Problem: CI Pytest MacOS (3.10) fails because float value is output with
a lower precision than in expected textproto.
(https://github.com/quantumlib/Cirq/actions/runs/3192951160/jobs/5211002538)

Solution: Update expected textproto to a lower precision and
replace high-precision values in the tested string.
  • Loading branch information
pavoljuhas committed Oct 5, 2022
1 parent 946f247 commit ff86325
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions cirq-google/cirq_google/calibration/phased_fsim_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ def test_xeb_to_calibration_layer():
layer_str = str(new_layer)
# Fix precision issues
layer_str = re.sub(r'0.004999\d+', '0.005', layer_str)
layer_str = re.sub(r'\b0.78539818\d*', '0.7853982', layer_str)
assert layer_str == desired_textproto


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ layer {
qubit_constant_index: 1
fsimgate {
theta {
float_value: 0.7853981852531433
float_value: 0.7853982
}
phi {
float_value: 0.0
Expand All @@ -24,7 +24,7 @@ layer {
qubit_constant_index: 3
fsimgate {
theta {
float_value: 0.7853981852531433
float_value: 0.7853982
}
phi {
float_value: 0.0
Expand Down

0 comments on commit ff86325

Please sign in to comment.