Skip to content

Commit

Permalink
merged tests for renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
gadhvirushiraj committed Aug 26, 2024
1 parent 2083e24 commit 0f8bf21
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
14 changes: 0 additions & 14 deletions tests/test_matrenderer.py

This file was deleted.

18 changes: 16 additions & 2 deletions tests/test_textrenderer.py → tests/test_renderer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pytest
import numpy as np
from unittest.mock import patch
from qutip_qip.circuit import QubitCircuit
from qutip_qip.operations import Gate, Measurement
from qutip_qip.circuit.text_renderer import TextRenderer


Expand Down Expand Up @@ -160,3 +160,17 @@ def test_render_str_len(request, qc_fixture):
assert (
len(set([len(wire) for wire in render_str])) == 1
), "Render wires have different lengths."


@pytest.mark.parametrize("qc_fixture", ["qc1", "qc2", "qc3"])
def test_matrenderer(request, qc_fixture):
"""
Check if Matplotlib renderer works without error.
"""
qc = request.getfixturevalue(qc_fixture)

with patch("matplotlib.pyplot.show"):
try:
qc.draw("matplotlib")
except Exception as e:
assert False, f"Error: {e}"

0 comments on commit 0f8bf21

Please sign in to comment.