Skip to content

Add assertion-based matplotlib tests for mpl_draw#1567

Merged
IvanIsCoding merged 2 commits intoQiskit:mainfrom
Rachel-Eva:fix-mpl-tests
Mar 17, 2026
Merged

Add assertion-based matplotlib tests for mpl_draw#1567
IvanIsCoding merged 2 commits intoQiskit:mainfrom
Rachel-Eva:fix-mpl-tests

Conversation

@Rachel-Eva
Copy link
Contributor

Fixes #1316
Replaces #1562

Adds a new TestMPLDrawAssertions test class that asserts actual properties of the matplotlib output rather than just checking that drawing doesn't crash. Tests are Linux-only as suggested by the maintainer.

New tests cover:

  • Node count reflected in collections
  • node_list filtering
  • Node color applied
  • Node labels drawn as text
  • Edge count
  • Directed graphs produce arrow patches
  • Edge labels drawn as text
  • node_size=0 produces zero-size collection
  • Empty graph produces no collections
  • I ran rustfmt locally
  • I have added the tests to cover my changes.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

Co-authored-by: Ivan Carvalho <8753214+IvanIsCoding@users.noreply.github.com>
@IvanIsCoding IvanIsCoding enabled auto-merge March 17, 2026 22:57
@IvanIsCoding IvanIsCoding added this pull request to the merge queue Mar 17, 2026
Merged via the queue into Qiskit:main with commit 98efff2 Mar 17, 2026
37 checks passed
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 this pull request may close these issues.

Add better Matplotlib tests

2 participants