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

Update quickplot to catch empty lists #3359

Merged
merged 5 commits into from
Sep 21, 2023

Conversation

kratman
Copy link
Contributor

@kratman kratman commented Sep 20, 2023

Description

I added some error handling for QuickPlot when an empty list is passed as the first argument.

Changes:

  • Added a check that raises an error when an empty list is passed: QuickPlot([])
  • Added a new test to confirm the check functions correctly.
  • Minor refactoring of QuickPlot to create new functions for the input pre-processing.

Fixes #3172

Type of change

Minor bug fix for catching empty input lists.

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ pre-commit run (or $ nox -s pre-commit) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)
  • All tests pass: $ python run-tests.py --all (or $ nox -s tests)
  • The documentation builds: $ python run-tests.py --doctest (or $ nox -s doctests)

You can run integration tests, unit tests, and doctests together at once, using $ python run-tests.py --quick (or $ nox -s quick).

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.02% ⚠️

Comparison is base (2eb5c59) 99.57% compared to head (243de25) 99.56%.
Report is 3 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3359      +/-   ##
===========================================
- Coverage    99.57%   99.56%   -0.02%     
===========================================
  Files          253      253              
  Lines        19571    19555      -16     
===========================================
- Hits         19488    19470      -18     
- Misses          83       85       +2     
Files Changed Coverage Δ
pybamm/plotting/quick_plot.py 99.72% <100.00%> (+<0.01%) ⬆️
pybamm/simulation.py 99.54% <100.00%> (-0.46%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Sponsor Member

@brosaplanella brosaplanella left a comment

Choose a reason for hiding this comment

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

Looks good, just a couple of things before approving. Can you address the small comment on the test and add an entry to the CHANGELOG?

tests/unit/test_plotting/test_quick_plot.py Outdated Show resolved Hide resolved
Copy link
Sponsor Member

@brosaplanella brosaplanella left a comment

Choose a reason for hiding this comment

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

Can you commit the suggested change? Happy to merge afterwards

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
@brosaplanella
Copy link
Sponsor Member

@all-contributors please add @kratman for tests

@allcontributors
Copy link
Contributor

@brosaplanella

I've put up a pull request to add @kratman! 🎉

@brosaplanella brosaplanella merged commit 080d91e into pybamm-team:develop Sep 21, 2023
31 of 34 checks passed
@kratman kratman deleted the feat/fixQuickPlot branch September 22, 2023 16:02
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.

Raise error if empty list passed to QuickPlot
2 participants