Skip to content

Commit

Permalink
remove pylint statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Jan 19, 2024
1 parent ca2ca17 commit d7a50dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
17 changes: 5 additions & 12 deletions tests/test_indicators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
# pylint: disable=unsubscriptable-object,function-redefined
# Tests for the Indicator objects
from __future__ import annotations

Expand Down Expand Up @@ -159,10 +159,7 @@ def test_attrs(tas_series):
assert f"xclim version: {__version__}" in txm.attrs["history"]
assert txm.name == "tmin5 degC"
assert uniIndTemp.standard_name == "{freq} mean temperature"
assert (
uniIndTemp.cf_attrs[0]["another_attr"] # pylint: disable=unsubscriptable-object
== "With a value."
)
assert uniIndTemp.cf_attrs[0]["another_attr"] == "With a value."

thresh = xr.DataArray(
[1],
Expand Down Expand Up @@ -260,7 +257,7 @@ def test_temp_unit_conversion(tas_series):
with pytest.raises(AssertionError):
np.testing.assert_array_almost_equal(txk, txc + 273.15)

uniIndTemp.cf_attrs[0]["units"] = "degC" # pylint: disable=unsubscriptable-object
uniIndTemp.cf_attrs[0]["units"] = "degC"
txc = uniIndTemp(a, freq="YS")
np.testing.assert_array_almost_equal(txk, txc + 273.15)

Expand Down Expand Up @@ -761,18 +758,14 @@ def func(data: xr.DataArray, thresh: str = "0 degC", freq: str = "YS"): # noqa
# with pytest.raises(ValueError, match="variable data is missing expected units"):
# Daily(**d)

d["parameters"]["thresh"] = {"units": "K"} # pylint: disable=function-redefined
d["parameters"]["thresh"] = {"units": "K"}
d["realm"] = "mercury"
d["input"] = {"data": "tasmin"}
with pytest.raises(AttributeError, match="Indicator's realm must be given as one"):
Daily(**d)

# fmt: off
def func( # noqa; # pylint: disable=function-redefined
data: xr.DataArray, thresh: str = "0 degC"
):
def func(data: xr.DataArray, thresh: str = "0 degC"):
return data
# fmt: on

func.__doc__ = "\n".join(doc[:10] + doc[12:])
d = dict(
Expand Down
7 changes: 2 additions & 5 deletions tests/test_sdba/test_adjustment.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=no-member
from __future__ import annotations

import numpy as np
Expand Down Expand Up @@ -711,11 +712,7 @@ class TestSBCKutils:
@pytest.mark.slow
@pytest.mark.parametrize(
"method",
# fmt: off
[
m for m in dir(adjustment) if m.startswith("SBCK_") # pylint: disable=no-member
],
# fmt: on
[m for m in dir(adjustment) if m.startswith("SBCK_")],
)
@pytest.mark.parametrize("use_dask", [True]) # do we gain testing both?
def test_sbck(self, method, use_dask, random):
Expand Down

0 comments on commit d7a50dc

Please sign in to comment.