-
-
Notifications
You must be signed in to change notification settings - Fork 400
Open
Description
-
I am on the latest Pendulum version.
-
I have searched the issues of this repo and believe that this is not a dup
-
OS version and name: macOS
-
Pendulum version: 3.0.0
Issue
If a Duration
has more than 7 days, deepcopy is wrong as there is no mention of weeks.
def test():
d = pendulum.Duration(days=9)
d1 = copy.deepcopy(d)
assert d1.total_days() == 9
gives
> assert d1.total_days() == 9
E assert 2.0 == 9
E + where 2.0 = total_days()
E + where total_days = Duration(days=2).total_days
This is because there is no weeks=self.weeks
in __deepcopy__
:
pendulum/src/pendulum/duration.py
Lines 463 to 472 in 6383c07
def __deepcopy__(self, _: dict[int, Self]) -> Self: | |
return self.__class__( | |
days=self.remaining_days, | |
seconds=self.remaining_seconds, | |
microseconds=self.microseconds, | |
minutes=self.minutes, | |
hours=self.hours, | |
years=self.years, | |
months=self.months, | |
) |
jgogstad and tealgreen0503
Metadata
Metadata
Assignees
Labels
No labels