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

Method travel

src/pendulum/testing/traveller.py:93–121  ·  view source on GitHub ↗
(
                self,
                years: int = 0,
                months: int = 0,
                weeks: int = 0,
                days: int = 0,
                hours: int = 0,
                minutes: int = 0,
                seconds: int = 0,
                microseconds: int = 0,
                *,
                freeze: bool = False,
            )

Source from the content-addressed store, hash-verified

91 return self
92
93 def travel(
94 self,
95 years: int = 0,
96 months: int = 0,
97 weeks: int = 0,
98 days: int = 0,
99 hours: int = 0,
100 minutes: int = 0,
101 seconds: int = 0,
102 microseconds: int = 0,
103 *,
104 freeze: bool = False,
105 ) -> Self:
106 self._start(freeze=freeze)
107
108 cast("time_machine.Coordinates", self._coordinates).move_to(
109 self._datetime_class.now().add(
110 years=years,
111 months=months,
112 weeks=weeks,
113 days=days,
114 hours=hours,
115 minutes=minutes,
116 seconds=seconds,
117 microseconds=microseconds,
118 )
119 )
120
121 return self
122
123 def travel_to(self, dt: DateTime, *, freeze: bool = False) -> Self:
124 self._start(freeze=freeze)

Callers 5

travelFunction · 0.45
_startMethod · 0.45
test_travelFunction · 0.45
test_freezeFunction · 0.45

Calls 3

_startMethod · 0.95
nowMethod · 0.80
addMethod · 0.45

Tested by 3

test_travelFunction · 0.36
test_freezeFunction · 0.36