Files
scientific-agent-skills/tests/qutip/test_qutip_graphics.py
T
Timothy Kassis 8cb0f52a35 Add initial test suite for autoskill functionality
- Introduced a comprehensive test suite for the autoskill project, including tests for backends, CLI commands, and various skill functionalities.
- Added smoke tests for LM Studio integration to validate real-time interactions.
- Implemented tests for session clustering and event fetching to ensure accurate data handling.
- Established a framework for skill description loading and matching, enhancing the robustness of skill management.
- Included redaction tests to verify sensitive information is properly handled in outputs.
- Created end-to-end tests to simulate the full autoskill pipeline, ensuring all components work together seamlessly.
2026-07-26 09:54:05 -07:00

65 lines
1.7 KiB
Python

"""Pinned plotting smoke tests for the QuTiP 5.3 graphics extra."""
from __future__ import annotations
import unittest
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt # noqa: E402
import numpy as np # noqa: E402
import qutip # noqa: E402
class GraphicsApiTests(unittest.TestCase):
def tearDown(self) -> None:
plt.close("all")
def test_phase_space_and_matrix_plotting_apis(self) -> None:
self.assertEqual(qutip.__version__, "5.3.0")
state = qutip.fock_dm(6, 1)
coordinates = np.linspace(-2.0, 2.0, 15)
fig, ax = qutip.plot_wigner(
state,
xvec=coordinates,
yvec=coordinates,
projection="2d",
colorbar=True,
)
self.assertIsNotNone(fig)
self.assertIsNotNone(ax)
fig, ax = qutip.plot_fock_distribution(state)
self.assertIsNotNone(fig)
self.assertIsNotNone(ax)
fig, ax = qutip.hinton(state, color_style="phase")
self.assertIsNotNone(fig)
self.assertIsNotNone(ax)
fig, ax = qutip.matrix_histogram(
state,
bar_style="abs",
color_style="phase",
)
self.assertIsNotNone(fig)
self.assertIsNotNone(ax)
def test_result_plot_expect_current_method(self) -> None:
result = qutip.sesolve(
0.5 * qutip.sigmax(),
qutip.basis(2, 0),
np.linspace(0.0, 1.0, 11),
e_ops=[qutip.sigmaz()],
)
fig, axes = result.plot_expect(labels=["sigma_z"])
self.assertIsNotNone(fig)
self.assertTrue(np.asarray(axes, dtype=object).size >= 1)
if __name__ == "__main__":
unittest.main()