8000 Document and test _get_packed_offsets() by timhoffm · Pull Request #14516 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Document and test _get_packed_offsets() #14516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 25, 2019

Conversation

timhoffm
Copy link
Member

PR Summary

Properly test and document matplotlib.offsetbox._get_packed_offsets().

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • Documentation is sphinx and numpydoc compliant

@@ -81,6 +117,9 @@ def _get_packed_offsets(wd_list, total, sep, mode="fixed"):
elif mode == "equal":
maxh = max(w_list)
if total is None:
if sep is None:
raise ValueError("total and sep cannot both be None when "
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This raised a TypeError before in the line below (int + None).

Since the function is private, we can do the change without announcement.

@timhoffm timhoffm force-pushed the get-packed-offsets branch from 2b51e13 to b40cef8 Compare June 10, 2019 13:19
@timhoffm timhoffm force-pushed the get-packed-offsets branch from b40cef8 to 67af4a6 Compare June 10, 2019 13:19
Co-Authored-By: Elliott Sales de Andrade <quantum.analyst@gmail.com>
@@ -123,4 +125,58 @@ def test_get_packed_offsets(wd_list, total, sep, mode):
# issue tickets (at least #10476 and #10784) related to corner cases
# triggered inside this function when calling higher-level functions
# (e.g. `Axes.legend`).
# These are just some additional smoke tests. The output is untested.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this test could just be deleted as it is essentially covered by the tests below?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly, e.g. I do not test negative total or sep. I agree that they'd better be tested explicitly for their output, but until then this is better than nothing.

Since it is not documented what should happen in this cases, I've left this as is (unresolved). IMHO that discussion is worth some thought and a separate PR.

Copy link
Member
@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to merge when fixed.

----------
wd_list : list of (float, float)
(width, xdescent) of boxes to be packed.
total : float or None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
total : float or None
total : float or *None*

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, I don't think we style parameter types.

timhoffm and others added 3 commits June 24, 2019 19:52
Co-Authored-By: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Co-Authored-By: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Co-Authored-By: Elliott Sales de Andrade <quantum.analyst@gmail.com>
@timhoffm timhoffm merged commit 896fb81 into matplotlib:master Jun 25, 2019
@timhoffm timhoffm deleted the get-packed-offsets branch June 25, 2019 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0