diff options
author | Paul Ganssle <paul@ganssle.io> | 2018-11-13 00:35:31 -0500 |
---|---|---|
committer | Paul Ganssle <paul@ganssle.io> | 2018-11-13 00:43:04 -0500 |
commit | fc984642eb2c48a78c2506b0d8b446a2a061f1ab (patch) | |
tree | 7b8cd4722a536a89950ec3df2ea272498b2c7eb7 | |
parent | feb301cc00de231bb079526695382b3b28944142 (diff) | |
download | dateutil-fc984642eb2c48a78c2506b0d8b446a2a061f1ab.tar.gz |
Add test for _DatetimeWithFold.replace
This ensures that positional arguments can be passed successfully
-rw-r--r-- | dateutil/test/test_tz.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/dateutil/test/test_tz.py b/dateutil/test/test_tz.py index 010cd73..362bd78 100644 --- a/dateutil/test/test_tz.py +++ b/dateutil/test/test_tz.py @@ -2652,6 +2652,15 @@ class TestEnfold: # Before Python 3.6, dt.fold won't exist if fold is 0. assert getattr(dt, 'fold', 0) == 0 + def test_fold_replace_args(self): + # This test can be dropped when Python < 3.6 is dropped, since it + # is mainly to cover the `replace` method on _DatetimeWithFold + dt = tz.enfold(datetime(1950, 1, 2, 12, 30, 15, 8), fold=1) + + dt2 = dt.replace(1952, 2, 3, 13, 31, 16, 9) + assert dt2 == tz.enfold(datetime(1952, 2, 3, 13, 31, 16, 9), fold=1) + assert dt2.fold == 1 + @pytest.mark.tz_resolve_imaginary class ImaginaryDateTest(unittest.TestCase): |