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

Increase coverage #2223

Merged
merged 30 commits into from
Sep 15, 2022
Merged

Increase coverage #2223

merged 30 commits into from
Sep 15, 2022

Conversation

brosaplanella
Copy link
Member

Various fixes to increase coverage and improve docstrings.

@brosaplanella brosaplanella marked this pull request as draft August 10, 2022 08:25
@brosaplanella brosaplanella marked this pull request as ready for review August 10, 2022 08:25
@codecov
Copy link

codecov bot commented Aug 10, 2022

Codecov Report

Base: 99.38% // Head: 99.63% // Increases project coverage by +0.25% 🎉

Coverage data is based on head (577f325) compared to base (4a8a221).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2223      +/-   ##
===========================================
+ Coverage    99.38%   99.63%   +0.25%     
===========================================
  Files          359      361       +2     
  Lines        19821    20014     +193     
===========================================
+ Hits         19699    19941     +242     
+ Misses         122       73      -49     
Impacted Files Coverage Δ
...bamm/expression_tree/operations/evaluate_python.py 99.30% <ø> (+1.00%) ⬆️
pybamm/models/event.py 100.00% <ø> (+4.16%) ⬆️
pybamm/solvers/scikits_ode_solver.py 97.56% <ø> (+8.27%) ⬆️
pybamm/expression_tree/concatenations.py 100.00% <100.00%> (+1.29%) ⬆️
pybamm/expression_tree/symbol.py 100.00% <100.00%> (+1.20%) ⬆️
...dels/full_battery_models/lead_acid/higher_order.py 98.14% <0.00%> (-0.02%) ⬇️
pybamm/util.py 100.00% <0.00%> (ø)
pybamm/__init__.py 100.00% <0.00%> (ø)
pybamm/solvers/solution.py 100.00% <0.00%> (ø)
pybamm/solvers/base_solver.py 100.00% <0.00%> (ø)
... and 45 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

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

Thanks!

@brosaplanella
Copy link
Member Author

There are still some additional changes I want to do before merging

Comment on lines 254 to 257
# with self.assertRaisesRegex(pybamm.ShapeError, "Cannot find shape"):
# pybamm.inner(
# pybamm.Matrix(np.zeros((2, 3))), pybamm.Matrix(np.ones((4, 5)))
# ).evaluate_ignoring_errors()
Copy link
Member Author

Choose a reason for hiding this comment

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

For some reason this test works on my computer but fails on GitHub actions. Locally it catches the pybamm.ShapeError but on GitHub it triggers the previous ValueError (e.g. see https://github.com/pybamm-team/PyBaMM/runs/7972858999?check_suite_focus=true). Any ideas?

Copy link
Member

Choose a reason for hiding this comment

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

It could be something to do with whether debug_mode is True or False, it sometimes behaves differently if you run an individual test script vs the whole test suite

Copy link
Member Author

Choose a reason for hiding this comment

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

It seemed to be related to tox. Anyway, when trying to debug I realised that the test wasn't actually triggering that error, but an error somewhere else, so not helping for the coverage. I also realised that that line actually threw an error that was not picked up earlier, so I changed that to a more generic statement like those in the previous lines. Let me know if that's OK or I should change it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nvm. It did something very weird: when debugging it didn't access that line, but if I change it I get an error because pybamm.ShapeError is not raised.

@brosaplanella
Copy link
Member Author

brosaplanella commented Sep 12, 2022

I don't think I will have time to work on this in the next few weeks so I think it is better to merge. @tinosulzer, can you give it a quick look?

Copy link
Member

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

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

thanks, just one minor comment!

@@ -265,6 +267,19 @@ def test_inner(self):
# check doesn't evaluate on edges anymore
self.assertEqual(model.variables["inner"].evaluates_on_edges("primary"), False)

# check _binary_jac
Copy link
Member

Choose a reason for hiding this comment

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

jacobian should be tested in test_jac.py

Copy link
Member Author

Choose a reason for hiding this comment

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

I have added a test_jac_of_binary_operator in test_jac.py. Let me know if that is what you meant.

Copy link
Member

Choose a reason for hiding this comment

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

yes

@valentinsulzer valentinsulzer merged commit 96e57ec into develop Sep 15, 2022
@valentinsulzer valentinsulzer deleted the increase-coverage branch September 15, 2022 02:50
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.

2 participants