File tree 2 files changed +8
-6
lines changed
2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -525,9 +525,10 @@ def _value_equality_values_(self) -> Any:
525
525
526
526
def __repr__ (self ) -> str :
527
527
name_str = f'name = "{ self .name } ", ' if self .name is not None else ''
528
+ gates_str = f'{ self ._gates_repr_str } , ' if len (self ._gates_repr_str ) > 0 else ''
528
529
return (
529
530
f'cirq.Gateset('
530
- f'{ self . _gates_repr_str } , '
531
+ f'{ gates_str } '
531
532
f'{ name_str } '
532
533
f'unroll_circuit_op = { self ._unroll_circuit_op } )'
533
534
)
Original file line number Diff line number Diff line change @@ -255,11 +255,12 @@ def test_gateset_init():
255
255
)
256
256
257
257
258
- def test_gateset_repr_and_str ():
259
- cirq .testing .assert_equivalent_repr (gateset )
260
- assert gateset .name in str (gateset )
261
- for gate_family in gateset .gates :
262
- assert str (gate_family ) in str (gateset )
258
+ @pytest .mark .parametrize ('g' , [gateset , cirq .Gateset (name = 'empty gateset' )])
259
+ def test_gateset_repr_and_str (g ):
260
+ cirq .testing .assert_equivalent_repr (g )
261
+ assert g .name in str (g )
262
+ for gate_family in g .gates :
263
+ assert str (gate_family ) in str (g )
263
264
264
265
265
266
@pytest .mark .parametrize (
You can’t perform that action at this time.
0 commit comments