Cirq icon indicating copy to clipboard operation
Cirq copied to clipboard

Add test class name to globals parameter when testing consistent protocols

Open Strilanc opened this issue 5 years ago • 3 comments

Strilanc avatar Feb 06 '19 19:02 Strilanc

@dstrain115

Strilanc avatar Feb 06 '19 19:02 Strilanc

See https://github.com/quantumlib/Cirq/issues/1235 for the previous work.

The problem is with controlled_gate_test. The two gates internal to that test, when repr is called, create a name of cirq.ops.controlled_gate_test which is not part of the cirq library (if tests are removed anyway), so this can create resolution problems when eval-ed as part of the consistent protocol check.

Passing the name to the globals parameter should fix this maybe.

dstrain115 avatar Feb 07 '19 21:02 dstrain115

From #1235

So, part of this is solved, but there is still an issue, since the representation on line 121 of controlled_gate_test still relies on an implicit import: return ('cirq.ops.controlled_gate_test.' 'GateUsingWorkspaceForApplyUnitary()')

Since the internal Google build splits the library code and the test code, cirq.ops.controlled_gate_test is not part of the cirq import, so the problem still exists. However, the problem is now contained to those two gates within controlled_gate_test.

dabacon avatar May 03 '20 18:05 dabacon

This is probably stale by now and so I'll close it.

tanujkhattar avatar Feb 02 '24 18:02 tanujkhattar