Skip to content
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

Fix bad references to deprecated Bit properties #9880

Closed
Eric-Arellano opened this issue Mar 30, 2023 · 1 comment · Fixed by #10844
Closed

Fix bad references to deprecated Bit properties #9880

Eric-Arellano opened this issue Mar 30, 2023 · 1 comment · Fixed by #10844

Comments

@Eric-Arellano
Copy link
Collaborator

Found in #9869.

test.python.visualization.test_circuit_latex.TestLatexSourceGenerator.test_teleport
-----------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/tmp/terra-tests/test/python/visualization/test_circuit_latex.py", line 144, in test_teleport
    circuit_drawer(circuit, filename=filename, output="latex_source")

      File "/home/vsts/work/1/s/qiskit/visualization/circuit/circuit_visualization.py", line 271, in circuit_drawer
    wire_order=wire_order,

      File "/home/vsts/work/1/s/qiskit/visualization/circuit/circuit_visualization.py", line 573, in _generate_latex_source
    latex = qcimg.latex()

      File "/home/vsts/work/1/s/qiskit/visualization/circuit/latex.py", line 214, in latex
    self._build_latex_array()

      File "/home/vsts/work/1/s/qiskit/visualization/circuit/latex.py", line 447, in _build_latex_array
    self._build_measure(node, column)

      File "/home/vsts/work/1/s/qiskit/visualization/circuit/latex.py", line 590, in _build_measure
    idx_str = str(node.cargs[0].index)

      File "/home/vsts/work/1/s/qiskit/utils/deprecation.py", line 91, in wrapper
    warnings.warn(msg, category=category, stacklevel=2)

    DeprecationWarning: The property ``qiskit.circuit.bit.Bit.index`` is deprecated as of qiskit-terra 0.17. It will be removed no earlier than 3 months after the release date. Instead, use the method ``QuantumCircuit.find_bit`` to find all the containing registers within a circuit and the index of the bit within the circuit.
test.python.visualization.timeline.test_layouts.TestBitArrange.test_qreg_creg_descending
----------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/tmp/terra-tests/test/python/visualization/timeline/test_layouts.py", line 48, in test_qreg_creg_descending
    sorted_regs = layouts.qreg_creg_descending(self.regs)

      File "/home/vsts/work/1/s/qiskit/visualization/timeline/layouts.py", line 114, in qreg_creg_descending
    qregs = sorted(qregs, key=lambda x: x.index, reverse=True)

      File "/home/vsts/work/1/s/qiskit/visualization/timeline/layouts.py", line 114, in <lambda>
    qregs = sorted(qregs, key=lambda x: x.index, reverse=True)

      File "/home/vsts/work/1/s/qiskit/utils/deprecation.py", line 91, in wrapper
    warnings.warn(msg, category=category, stacklevel=2)

    DeprecationWarning: The property ``qiskit.circuit.bit.Bit.index`` is deprecated as of qiskit-terra 0.17. It will be removed no earlier than 3 months after the release date. Instead, use the method ``QuantumCircuit.find_bit`` to find all the containing registers within a circuit and the index of the bit within the circuit.
@jakelishman
Copy link
Member

Copied (in spirit) from internal Slack discussion:

I'd be surprised if this is the only place using these deprecated properties still, but maybe we've cut more of them out than I thought. There is an explicit filter to allow this particular warning in QiskitTestCase (a practice I disagree with, with regards to warnings raised by Terra!) - to find all the instances when running on main, one could comment out that filter then find and fix all the resulting test errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants