Cirq
Cirq copied to clipboard
Add test class name to globals parameter when testing consistent protocols
@dstrain115
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.
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.
This is probably stale by now and so I'll close it.