-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add serialization test for plotter and nested drawer
- Loading branch information
1 parent
9f17386
commit c40594c
Showing
5 changed files
with
187 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This code is part of Qiskit. | ||
# | ||
# (C) Copyright IBM 2022. | ||
# | ||
# This code is licensed under the Apache License, Version 2.0. You may | ||
# obtain a copy of this license in the LICENSE.txt file in the root directory | ||
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Any modifications or derivative works of this code must retain this | ||
# copyright notice, and modified files need to carry a notice indicating | ||
# that they have been altered from the originals. | ||
""" | ||
Test Matplotlib Drawer. | ||
""" | ||
|
||
from copy import copy | ||
from test.base import QiskitExperimentsTestCase | ||
|
||
import matplotlib | ||
from qiskit_experiments.visualization import MplDrawer | ||
|
||
|
||
class TestMplDrawer(QiskitExperimentsTestCase): | ||
"""Test MplDrawer.""" | ||
|
||
def test_end_to_end(self): | ||
"""Test that MplDrawer generates something.""" | ||
drawer = MplDrawer() | ||
|
||
# Draw dummy data | ||
drawer.initialize_canvas() | ||
drawer.draw_raw_data([0, 1, 2], [0, 1, 2], "seriesA") | ||
drawer.draw_formatted_data([0, 1, 2], [0, 1, 2], [0.1, 0.1, 0.1], "seriesA") | ||
drawer.draw_line([3, 2, 1], [1, 2, 3], "seriesB") | ||
drawer.draw_confidence_interval([0, 1, 2, 3], [1, 2, 1, 2], [-1, -2, -1, -2], "seriesB") | ||
drawer.draw_report(r"Dummy report text with LaTex $\beta$") | ||
|
||
# Get result | ||
fig = drawer.figure | ||
|
||
# Check that | ||
self.assertTrue(fig is not None) | ||
self.assertTrue(isinstance(fig, matplotlib.pyplot.Figure)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters