projects/guix·blob java-team · refs

47 lines · 1.7 KiB

1from https://salsa.debian.org/science-team/pandas/-/raw/main/debian/patches/no_pytz_datetime.patch
2
3Description: datetime does not work with non-constant pytz.timezone
4
5This has always been the case (and is explicitly warned about
6in the pytz documentation), but became a test fail when
7tzdata 2024b changed 'CET' and similar to aliases.
8
9Author: Rebecca N. Palmer <[email protected]>
10Forwarded: no
11
12--- a/pandas/tests/arrays/test_array.py
13+++ b/pandas/tests/arrays/test_array.py
14@@ -272,7 +272,8 @@ def test_array_copy():
15 assert tm.shares_memory(a, b)
16
17
18-cet = pytz.timezone("CET")
19+cetfixed = pytz.timezone("Etc/GMT-1") # the wrong-looking sign is because Etc/* use posix convention, as described in the tzdata source
20+cetwithdst = pytz.timezone("Europe/Brussels")
21
22
23 @pytest.mark.parametrize(
24@@ -313,11 +314,20 @@ cet = pytz.timezone("CET")
25 ),
26 (
27 [
28- datetime.datetime(2000, 1, 1, tzinfo=cet),
29- datetime.datetime(2001, 1, 1, tzinfo=cet),
30+ datetime.datetime(2000, 1, 1, tzinfo=cetfixed),
31+ datetime.datetime(2001, 1, 1, tzinfo=cetfixed),
32 ],
33 DatetimeArray._from_sequence(
34- ["2000", "2001"], dtype=pd.DatetimeTZDtype(tz=cet, unit="ns")
35+ ["2000", "2001"], dtype=pd.DatetimeTZDtype(tz=cetfixed, unit="ns")
36+ ),
37+ ),
38+ (
39+ [
40+ cetwithdst.localize(datetime.datetime(2000, 1, 1)),
41+ cetwithdst.localize(datetime.datetime(2001, 1, 1)),
42+ ],
43+ DatetimeArray._from_sequence(
44+ ["2000", "2001"], dtype=pd.DatetimeTZDtype(tz=cetwithdst, unit="ns")
45 ),
46 ),
47 # timedelta