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

Function assert_duration

tests/conftest.py:74–120  ·  view source on GitHub ↗
(
    dur: pendulum.Duration,
    years: int | None = None,
    months: int | None = None,
    weeks: int | None = None,
    days: int | None = None,
    hours: int | None = None,
    minutes: int | None = None,
    seconds: int | None = None,
    microseconds: int | None = None,
)

Source from the content-addressed store, hash-verified

72
73
74def assert_duration(
75 dur: pendulum.Duration,
76 years: int | None = None,
77 months: int | None = None,
78 weeks: int | None = None,
79 days: int | None = None,
80 hours: int | None = None,
81 minutes: int | None = None,
82 seconds: int | None = None,
83 microseconds: int | None = None,
84) -> None:
85 expected = {}
86 actual = {}
87
88 if years is not None:
89 expected["years"] = dur.years
90 actual["years"] = years
91
92 if months is not None:
93 expected["months"] = dur.months
94 actual["months"] = months
95
96 if weeks is not None:
97 expected["weeks"] = dur.weeks
98 actual["weeks"] = weeks
99
100 if days is not None:
101 expected["days"] = dur.remaining_days
102 actual["days"] = days
103
104 if hours is not None:
105 expected["hours"] = dur.hours
106 actual["hours"] = hours
107
108 if minutes is not None:
109 expected["minutes"] = dur.minutes
110 actual["minutes"] = minutes
111
112 if seconds is not None:
113 expected["seconds"] = dur.remaining_seconds
114 actual["seconds"] = seconds
115
116 if microseconds is not None:
117 expected["microseconds"] = dur.microseconds
118 actual["microseconds"] = microseconds
119
120 assert expected == actual

Callers 15

test_parse_durationFunction · 0.90
test_add_intervalFunction · 0.90
test_add_timedeltaFunction · 0.90
test_sub_intervalFunction · 0.90
test_sub_timedeltaFunction · 0.90
test_negFunction · 0.90
test_deepcopyFunction · 0.90
test_multiplyFunction · 0.90
test_divideFunction · 0.90
test_floor_divideFunction · 0.90
test_defaultsFunction · 0.90
test_yearsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…