Skip to content
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

plt.box_bug_fix #11409

Merged
merged 1 commit into from Jun 11, 2018
Merged

plt.box_bug_fix #11409

merged 1 commit into from Jun 11, 2018

Conversation

fredrik-1
Copy link
Contributor

@fredrik-1 fredrik-1 commented Jun 10, 2018

I found a small bug in plt.box. The toggling didn't work because _string_to_bool changed None to False before the test for None.

edit: I have no idea why codecov/patch complain.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell
Copy link
Member

The reason that codecov is failing as that this code path is not currently tested at all!

Could you add a test in test_pyplot that looks something like

fig, ax = plt.subplots()
# assert frame on
plt.box()
# assert frame off
plt.box()
# assert frame on

?

@tacaswell tacaswell added this to the v3.0 milestone Jun 10, 2018
@timhoffm
Copy link
Member

Thanks for finding that bug!

A full test for the box() function would be:

def test_pyplot_box():
    fig, ax = plt.subplots()
    plt.box(False)
    assert not ax.get_frame_on()
    plt.box(True)
    assert ax.get_frame_on()
    plt.box()
    assert not ax.get_frame_on()
    plt.box()
    assert ax.get_frame_on()

Could you please add that to test_pyplot.py? (If not, we can do it later in a separate PR.)

@fredrik-1
Copy link
Contributor Author

Added the test

@timhoffm timhoffm modified the milestones: v3.0, v2.2.3 Jun 11, 2018
@timhoffm timhoffm merged commit 5672341 into matplotlib:master Jun 11, 2018
@lumberbot-app
Copy link

lumberbot-app bot commented Jun 11, 2018

There seem to be a conflict, please backport manually

@fredrik-1 fredrik-1 deleted the plt.box_bug_fix branch June 11, 2018 16:27
@fredrik-1 fredrik-1 restored the plt.box_bug_fix branch June 11, 2018 16:28
timhoffm added a commit to timhoffm/matplotlib that referenced this pull request Jun 11, 2018
@fredrik-1 fredrik-1 deleted the plt.box_bug_fix branch June 13, 2018 04:54
jklymak added a commit that referenced this pull request Jun 13, 2018
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.

None yet

4 participants