MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / test_accuracy

Function test_accuracy

tests/interval/test_construct.py:48–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46
47
48def test_accuracy():
49 dt1 = pendulum.DateTime(2000, 11, 20)
50 dt2 = pendulum.DateTime(2000, 11, 25)
51 dt3 = pendulum.DateTime(2016, 11, 5)
52 p1 = pendulum.interval(dt1, dt3)
53 p2 = pendulum.interval(dt2, dt3)
54
55 assert p1.years == 15
56 assert p1.in_years() == 15
57 assert p1.months == 11
58 assert p1.in_months() == 191
59 assert p1.days == 5829
60 assert p1.remaining_days == 2
61 assert p1.in_days() == 5829
62
63 assert p2.years == 15
64 assert p2.in_years() == 15
65 assert p2.months == 11
66 assert p2.in_months() == 191
67 assert p2.days == 5824
68 assert p2.remaining_days == 4
69 assert p2.in_days() == 5824
70
71
72def test_dst_transition():

Callers

nothing calls this directly

Calls 3

in_yearsMethod · 0.80
in_monthsMethod · 0.80
in_daysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…