Skip to content

fix: consume Matplotlib format markers - #144

Open
RoboX2020 wants to merge 2 commits into
petercorke:mainfrom
RoboX2020:fix/matplotlib-format-markers
Open

RoboX2020 wants to merge 2 commits into
petercorke:mainfrom
RoboX2020:fix/matplotlib-format-markers

Conversation

@RoboX2020

Copy link
Copy Markdown

The compact-format parser recognizes a marker but leaves it in working_fmt, so valid strings such as 'o', 'ro--', 'g^:' and '-.b*' raise ValueError as unrecognized components.

Remove the matched marker once, like the color and linestyle, before checking for leftover characters. Invalid duplicate markers and unmatched characters still raise.

Added nine checks covering the documented combined formats, a marker alone, tuple input, keyword precedence, and invalid leftovers. Six fail on the original implementation. The valid-format tests also create a Matplotlib line and check its marker.

Validation on Python 3.11:

  • New tests: 9 passed on OpenCV 4.12.0.88 and 5.0.0.93.
  • Full OpenCV 5 suite: 968 passed, 97 skipped, 5 subtests passed.
  • Test file passes ruff and black.
  • Inspected a headless render of the three combined formats: red circles/dashes, green triangles/dots, and blue stars/dash-dot lines.

Full suite on OpenCV 4 and a desktop GUI were not run. This is a one-line production fix, not an extension of the accepted format syntax.

Check marker formats, tuple input, option precedence and rejection of unmatched characters.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

This branch has not been deployed

No deployments
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.

1 participant