Skip to content

Commit

Permalink
tests: Update US/Eastern timezone to America/New_York (#8153)
Browse files Browse the repository at this point in the history
* tests: Update US/Eastern timezone to America/New_York

Reason is that US/Eastern symlink moved from tzdata to tzdata-legacy package,
causing FTBFS. Since America/New_York is better supported by tzdata,
the switch makes the package stronger against future failures

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Deepak Cherian <[email protected]>
  • Loading branch information
3 people authored Sep 8, 2023
1 parent e2b6f34 commit a7ab5a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion xarray/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4698,7 +4698,7 @@ def test_convert_dataframe_with_many_types_and_multiindex(self) -> None:
"e": [True, False, True],
"f": pd.Categorical(list("abc")),
"g": pd.date_range("20130101", periods=3),
"h": pd.date_range("20130101", periods=3, tz="US/Eastern"),
"h": pd.date_range("20130101", periods=3, tz="America/New_York"),
}
)
df.index = pd.MultiIndex.from_product([["a"], range(3)], names=["one", "two"])
Expand Down
22 changes: 13 additions & 9 deletions xarray/tests/test_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2604,7 +2604,7 @@ def test_datetime(self):

@requires_pandas_version_two
def test_tz_datetime(self) -> None:
tz = pytz.timezone("US/Eastern")
tz = pytz.timezone("America/New_York")
times_ns = pd.date_range("2000", periods=1, tz=tz)

times_s = times_ns.astype(pd.DatetimeTZDtype("s", tz))
Expand Down Expand Up @@ -2904,9 +2904,11 @@ def test_from_pint_wrapping_dask(self, Var):
(pd.date_range("2000", periods=1), False),
(datetime(2000, 1, 1), False),
(np.array([datetime(2000, 1, 1)]), False),
(pd.date_range("2000", periods=1, tz=pytz.timezone("US/Eastern")), False),
(pd.date_range("2000", periods=1, tz=pytz.timezone("America/New_York")), False),
(
pd.Series(pd.date_range("2000", periods=1, tz=pytz.timezone("US/Eastern"))),
pd.Series(
pd.date_range("2000", periods=1, tz=pytz.timezone("America/New_York"))
),
False,
),
],
Expand All @@ -2929,7 +2931,7 @@ def test_datetime_conversion_warning(values, warns_under_pandas_version_two) ->
# the case that the variable is backed by a timezone-aware
# DatetimeIndex, and thus is hidden within the PandasIndexingAdapter class.
assert var._data.array.dtype == pd.DatetimeTZDtype(
"ns", pytz.timezone("US/Eastern")
"ns", pytz.timezone("America/New_York")
)


Expand All @@ -2941,12 +2943,14 @@ def test_pandas_two_only_datetime_conversion_warnings() -> None:
(pd.date_range("2000", periods=1), "datetime64[s]"),
(pd.Series(pd.date_range("2000", periods=1)), "datetime64[s]"),
(
pd.date_range("2000", periods=1, tz=pytz.timezone("US/Eastern")),
pd.DatetimeTZDtype("s", pytz.timezone("US/Eastern")),
pd.date_range("2000", periods=1, tz=pytz.timezone("America/New_York")),
pd.DatetimeTZDtype("s", pytz.timezone("America/New_York")),
),
(
pd.Series(pd.date_range("2000", periods=1, tz=pytz.timezone("US/Eastern"))),
pd.DatetimeTZDtype("s", pytz.timezone("US/Eastern")),
pd.Series(
pd.date_range("2000", periods=1, tz=pytz.timezone("America/New_York"))
),
pd.DatetimeTZDtype("s", pytz.timezone("America/New_York")),
),
]
for data, dtype in cases:
Expand All @@ -2960,7 +2964,7 @@ def test_pandas_two_only_datetime_conversion_warnings() -> None:
# the case that the variable is backed by a timezone-aware
# DatetimeIndex, and thus is hidden within the PandasIndexingAdapter class.
assert var._data.array.dtype == pd.DatetimeTZDtype(
"ns", pytz.timezone("US/Eastern")
"ns", pytz.timezone("America/New_York")
)


Expand Down

0 comments on commit a7ab5a2

Please sign in to comment.