-
-
Notifications
You must be signed in to change notification settings - Fork 738
chore: enable pytest ruff rule and apply fixes #4928
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
02ce286
6fe1393
d6fd91a
92ef142
34c4a7a
5dc454b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,8 +189,8 @@ def test_interpolation(self): | |
| ) | ||
|
|
||
| # error for not recognized interpolator | ||
| interp = pybamm.Interpolant(x, data, y, interpolator="idonotexist") | ||
Saransh-cpp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| with pytest.raises(ValueError, match="interpolator"): | ||
| interp = pybamm.Interpolant(x, data, y, interpolator="idonotexist") | ||
| interp_casadi = interp.to_casadi(y=casadi_y) | ||
|
|
||
| # error for converted children count | ||
|
|
@@ -203,8 +203,8 @@ def test_interpolation(self): | |
| x4_ = [np.linspace(0, 1) for _ in range(4)] | ||
| x4 = np.column_stack(x4_) | ||
| data4 = 2 * x4 # np.tile(2 * x3, (10, 1)).T | ||
| interp = pybamm.Interpolant(x4_, data4, y4, interpolator="linear") | ||
Saransh-cpp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| with pytest.raises(ValueError, match="Invalid dimension of x"): | ||
| interp = pybamm.Interpolant(x4_, data4, y4, interpolator="linear") | ||
| interp_casadi = interp.to_casadi(y=casadi_y) | ||
|
|
||
|
Comment on lines
207
to
209
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This part looks off to me. If the raise value error happens in the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a few other places with similar changes |
||
| def test_interpolation_2d(self): | ||
|
|
@@ -247,8 +247,8 @@ def test_interpolation_2d(self): | |
| # np.testing.assert_allclose(interp.evaluate(y=y_test), f(y_test), rtol=1e-7, atol=1e-6) | ||
|
|
||
| # error for pchip interpolator | ||
| interp = pybamm.Interpolant(x_, Y, y, interpolator="pchip") | ||
| with pytest.raises(ValueError, match="interpolator should be"): | ||
| interp = pybamm.Interpolant(x_, Y, y, interpolator="pchip") | ||
| interp_casadi = interp.to_casadi(y=casadi_y) | ||
|
|
||
| def test_interpolation_3d(self): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |
| import numpy as np | ||
|
|
||
|
|
||
| @pytest.fixture() | ||
| @pytest.fixture | ||
| def param(): | ||
| return pybamm.ParameterValues( | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,8 +46,8 @@ def test_changing_number_of_rcs(self): | |
| model = pybamm.equivalent_circuit.Thevenin(options=options) | ||
| model.check_well_posedness() | ||
|
|
||
| with pytest.raises(pybamm.OptionError, match="natural numbers"): | ||
| options = {"number of rc elements": -1} | ||
| options = {"number of rc elements": -1} | ||
| with pytest.raises(pybamm.OptionError, match="natural numbers"): # noqa: PT012 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is being suppressed here? |
||
| model = pybamm.equivalent_circuit.Thevenin(options=options) | ||
| model.check_well_posedness() | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.