Skip to content

Commit

Permalink
Fix PeriodIndex deprecation in xarray tests (pydata#8182)
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty authored Sep 14, 2023
1 parent 0c4f165 commit 756eee6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def setup(self, dtype, subset):
[
list("abcdefhijk"),
list("abcdefhijk"),
pd.date_range(start="2000-01-01", periods=1000, freq="B"),
pd.date_range(start="2000-01-01", periods=1000, freq="D"),
]
)
series = pd.Series(data, index)
Expand Down
2 changes: 1 addition & 1 deletion xarray/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def test_repr_multiindex(self) -> None:

def test_repr_period_index(self) -> None:
data = create_test_data(seed=456)
data.coords["time"] = pd.period_range("2000-01-01", periods=20, freq="B")
data.coords["time"] = pd.period_range("2000-01-01", periods=20, freq="D")

# check that creating the repr doesn't raise an error #GH645
repr(data)
Expand Down
6 changes: 3 additions & 3 deletions xarray/tests/test_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ def test_pandas_data(self):
assert v[0].values == v.values[0]

def test_pandas_period_index(self):
v = self.cls(["x"], pd.period_range(start="2000", periods=20, freq="B"))
v = self.cls(["x"], pd.period_range(start="2000", periods=20, freq="D"))
v = v.load() # for dask-based Variable
assert v[0] == pd.Period("2000", freq="B")
assert "Period('2000-01-03', 'B')" in repr(v)
assert v[0] == pd.Period("2000", freq="D")
assert "Period('2000-01-01', 'D')" in repr(v)

@pytest.mark.parametrize("dtype", [float, int])
def test_1d_math(self, dtype: np.typing.DTypeLike) -> None:
Expand Down

0 comments on commit 756eee6

Please sign in to comment.