Renamed 'Cell capacity [A.h]' to 'Nominal cell capacity [A.h]'#1352
Conversation
|
Please guide me as to how to fix the failing checks. |
brosaplanella
left a comment
There was a problem hiding this comment.
Looks good in general, thanks @Saransh-cpp! Ignore the macos tests for the moment as they fail for another reason. The ubuntu tests fail because there are some examples (both scripts and notebooks) which still call "Cell capacity [A.h]".
Working on it! |
…'Nominal cell capacity [A.h]'
Codecov Report
@@ Coverage Diff @@
## develop #1352 +/- ##
========================================
Coverage 98.15% 98.15%
========================================
Files 272 272
Lines 15577 15605 +28
========================================
+ Hits 15289 15317 +28
Misses 288 288
Continue to review full report at Codecov.
|
|
The last thing to do is to add a test to improve the coverage (see the Codecov report above). The error and warning messages in |
I was trying to write the tests but cannot figure out what should I replace I tried writing For Please guide, |
|
So, these lines should contain a command that you expect to trigger the error/warning. For the warning, I think that |
|
Thank you so much @brosaplanella |
| ) | ||
| else: | ||
| values["Nominal cell capacity [A.h]"] = values["Cell capacity [A.h]"] | ||
| warnings.warn( |
There was a problem hiding this comment.
You need to pass DeprecationWarning as an argument (see below) otherwise it raises a generic warning and that's why the test fails.
warnings.warn(
"the 'Cell capacity [A.h]' notation will be "
"deprecated in the next release, as it has now been renamed "
"to 'Nominal cell capacity [A.h]'. Simulation will continue "
"passing the 'Cell capacity [A.h]' as 'Nominal cell "
"capacity [A.h]' (it might overwrite any existing definition "
"of the component)",
DeprecationWarning,
)There was a problem hiding this comment.
Yes, my bad, I didn't run the tests on my side. Running them now for confirmation.
There was a problem hiding this comment.
After adding this and running the tests, it gives me an error
pybamm.ParameterValues({"Cell capacity [A.h]": 0})
AssertionError: "Cell capacity [A.h]" does not match "the 'Cell capacity [A.h]' notation will be deprecated in the next release, as it has now been renamed to 'Nominal cell capacity [A.h]'. Simulation
will continue passing the 'Cell capacity [A.h]' as 'Nominal cell capacity [A.h]' (it might overwrite any existing definition of the component)"
How can I resolve this?
There was a problem hiding this comment.
I don't know... Maybe try passing only "Cell capacity". Also, I don't think it is the source of any issue, but might be good to define the capacities in the test to be 1 rather than 0, as a 0 capacity could potentially lead to further issues.
There was a problem hiding this comment.
I tried that but then it shows the "Deprecation warning not triggered" error. I am looking into it, if you find the issue please let me know. Thanks
There was a problem hiding this comment.
Yes I did that, it does not give me the "Deprecation warning not triggered" with "Cell capacity [A.h]" but it does give me the same error with "Cell capacity".
There was a problem hiding this comment.
Can you push your recent changes so I can see the full error messages from the automatic tests?
There was a problem hiding this comment.
Yes sure, I was trying to use values=, but that didn't work out as well.
There was a problem hiding this comment.
I tried it locally and it seems the issue is with [A.h]. It seems that this runs fine:
# Cell capacity [A.h] deprecated
with self.assertRaisesRegex(ValueError, "Cell capacity"):
pybamm.ParameterValues({"Cell capacity [A.h]": 1,
"Nominal cell capacity [A.h]": 1})
with self.assertWarnsRegex(DeprecationWarning, "Cell capacity"):
pybamm.ParameterValues({"Cell capacity [A.h]": 1})|
@all-contributors add @Saransh-cpp for code and tests |
|
I've put up a pull request to add @Saransh-cpp! 🎉 |
brosaplanella
left a comment
There was a problem hiding this comment.
Looks good, thanks @Saransh-cpp! We have a bit PR to merge, so I will wait to merge this one until the other is done as it will be easier to handle it this way.
|
@brosaplanella okay, thanks! |
Description
Addressing #1339, changed the name, added value error and deprecation error. Hopefully this closes the issue.
Type of change
Renamed 'Cell capacity [A.h]'. I will add the following changes in CHANGELOG.md and list it in the breaking changes section.
Key checklist:
$ flake8$ python run-tests.py --unit$ cd docsand then$ make clean; make htmlYou can run all three at once, using
$ python run-tests.py --quick.Further checks: