1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
from __future__ import annotations
import pendulum
from tests.conftest import assert_date
def test_fluid_year_setter():
d = pendulum.Date(2016, 10, 20)
new = d.set(year=1995)
assert_date(new, 1995, 10, 20)
assert new.year == 1995
def test_fluid_month_setter():
d = pendulum.Date(2016, 7, 2)
new = d.set(month=11)
assert new.month == 11
assert d.month == 7
def test_fluid_day_setter():
d = pendulum.Date(2016, 7, 2)
new = d.set(day=9)
assert new.day == 9
assert d.day == 2
|