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

Function test_timedelta_behavior

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

Source from the content-addressed store, hash-verified

86
87
88def test_timedelta_behavior():
89 dt1 = pendulum.DateTime(2000, 11, 20, 1)
90 dt2 = pendulum.DateTime(2000, 11, 25, 2)
91 dt3 = pendulum.DateTime(2016, 11, 5, 3)
92
93 p1 = pendulum.interval(dt1, dt3)
94 p2 = pendulum.interval(dt2, dt3)
95 it1 = p1.as_timedelta()
96 it2 = p2.as_timedelta()
97
98 assert it1.total_seconds() == p1.total_seconds()
99 assert it2.total_seconds() == p2.total_seconds()
100 assert it1.days == p1.days
101 assert it2.days == p2.days
102 assert it1.seconds == p1.seconds
103 assert it2.seconds == p2.seconds
104 assert it1.microseconds == p1.microseconds
105 assert it2.microseconds == p2.microseconds
106
107
108def test_different_timezones_same_time():

Callers

nothing calls this directly

Calls 2

as_timedeltaMethod · 0.80
total_secondsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…