Skip to content

Commit 84bfff2

Browse files
committed
TST: add basic test for construction with fold
1 parent ba08390 commit 84bfff2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Diff for: pandas/_libs/tslibs/timestamps.pyx

+2-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ class Timestamp(_Timestamp):
351351
second=None,
352352
microsecond=None,
353353
nanosecond=None,
354-
tzinfo=None
354+
tzinfo=None,
355+
fold=None
355356
):
356357
# The parameter list folds together legacy parameter names (the first
357358
# four) and positional and keyword parameter names from pydatetime.

Diff for: pandas/tests/indexes/datetimes/test_constructors.py

+10
Original file line numberDiff line numberDiff line change
@@ -964,3 +964,13 @@ def test_timestamp_constructor_identity():
964964
expected = pd.Timestamp("2017-01-01T12")
965965
result = pd.Timestamp(expected)
966966
assert result is expected
967+
968+
969+
@pytest.mark.parametrize("tz", ["dateutil/Europe/London", "Europe/London"])
970+
@pytest.mark.parametrize("fold", [0, 1])
971+
def test_timestamp_constructor_fold(tz, fold):
972+
# Test for #25057
973+
ts = pd.Timestamp(year=2019, month=10, day=27, hour=1, minute=30, tz=tz, fold=fold)
974+
result = ts.fold
975+
expected = fold
976+
assert result == expected

0 commit comments

Comments
 (0)