File: test_fluent_setters.py

package info (click to toggle)
pendulum 3.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,780 kB
  • sloc: python: 18,420; makefile: 41
file content (29 lines) | stat: -rw-r--r-- 531 bytes parent folder | download | duplicates (2)
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