Skip to content

Commit f5b42b8

Browse files
committed
Ignore week/weekofyear attributes in tests
1 parent 38efb17 commit f5b42b8

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
lines changed

pandas/tests/arrays/test_datetimelike.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ def test_bool_properties(self, datetime_index, propname):
469469

470470
@pytest.mark.parametrize("propname", pd.DatetimeIndex._field_ops)
471471
def test_int_properties(self, datetime_index, propname):
472+
if propname in ["week", "weekofyear"]:
473+
# GH#33595 Deprecate week and weekofyear
474+
return
472475
dti = datetime_index
473476
arr = DatetimeArray(dti)
474477

pandas/tests/indexes/datetimes/test_misc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ def test_datetimeindex_accessors(self):
205205

206206
# non boolean accessors -> return Index
207207
for accessor in DatetimeIndex._field_ops:
208+
if accessor in ["week", "weekofyear"]:
209+
# GH#33595 Deprecate week and weekofyear
210+
continue
208211
res = getattr(dti, accessor)
209212
assert len(res) == 365
210213
assert isinstance(res, Index)

pandas/tests/indexes/datetimes/test_scalar_compat.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ def test_dti_date_out_of_range(self, data):
4040
[
4141
"dayofweek",
4242
"dayofyear",
43-
"week",
44-
"weekofyear",
4543
"quarter",
4644
"days_in_month",
4745
"is_month_start",

pandas/tests/scalar/test_nat.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ def test_nat_vector_field_access():
6666
# on NaT/Timestamp for compat with datetime
6767
if field == "weekday":
6868
continue
69+
if field in ["week", "weekofyear"]:
70+
# GH#33595 Deprecate week and weekofyear
71+
continue
6972

7073
result = getattr(idx, field)
7174
expected = Index([getattr(x, field) for x in idx])
@@ -78,6 +81,9 @@ def test_nat_vector_field_access():
7881
# on NaT/Timestamp for compat with datetime
7982
if field == "weekday":
8083
continue
84+
if field in ["week", "weekofyear"]:
85+
# GH#33595 Deprecate week and weekofyear
86+
continue
8187

8288
result = getattr(ser.dt, field)
8389
expected = [getattr(x, field) for x in idx]

pandas/tests/series/test_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,9 @@ def test_dt_accessor_api_for_categorical(self):
719719
tm.assert_equal(res, exp)
720720

721721
for attr in attr_names:
722+
if attr in ["week", "weekofyear"]:
723+
# GH#33595 Deprecate week and weekofyear
724+
continue
722725
res = getattr(c.dt, attr)
723726
exp = getattr(s.dt, attr)
724727

pandas/tests/series/test_datetime_values.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def compare(s, name):
8989
for s in cases:
9090
for prop in ok_for_dt:
9191
# we test freq below
92-
if prop != "freq":
92+
# we ignore week and weekofyear because they are deprecated
93+
if prop not in ["freq", "week", "weekofyear"]:
9394
compare(s, prop)
9495

9596
for prop in ok_for_dt_methods:
@@ -122,7 +123,8 @@ def compare(s, name):
122123
for prop in ok_for_dt:
123124

124125
# we test freq below
125-
if prop != "freq":
126+
# we ignore week and weekofyear because they are deprecated
127+
if prop not in ["freq", "week", "weekofyear"]:
126128
compare(s, prop)
127129

128130
for prop in ok_for_dt_methods:

0 commit comments

Comments
 (0)