Skip to content

Commit

Permalink
Run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Apr 4, 2024
1 parent 13efeac commit 3de1fb2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions dateparser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,11 +598,13 @@ def _correct_for_month(self, dateobj):
relative_base_month = (
relative_base.month if hasattr(relative_base, "month") else relative_base
)

if getattr(self, "_token_month", None):
return dateobj

dateobj = set_correct_month_from_settings(dateobj, self.settings, relative_base_month)
dateobj = set_correct_month_from_settings(
dateobj, self.settings, relative_base_month
)
return dateobj

@classmethod
Expand Down
9 changes: 6 additions & 3 deletions tests/test_date_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,6 @@ def test_prefer_dates_from_with_timezone(
self.then_date_was_parsed_by_date_parser()
self.then_date_obj_exactly_is(expected)


@parameterized.expand(
[
param(
Expand Down Expand Up @@ -1304,7 +1303,7 @@ def test_prefer_dates_from_with_timezone(
expected=datetime(2015, 12, 31),
),
param(
"2020", #Leap year last day test
"2020", # Leap year last day test
prefer_day="last",
prefer_month="current",
today=datetime(2010, 2, 10),
Expand All @@ -1316,7 +1315,11 @@ def test_dates_with_no_day_or_month(
self, date_string, prefer_day, prefer_month, today=None, expected=None
):
self.given_parser(
settings={"PREFER_DAY_OF_MONTH": prefer_day, "PREFER_MONTH_OF_YEAR": prefer_month, "RELATIVE_BASE": today}
settings={
"PREFER_DAY_OF_MONTH": prefer_day,
"PREFER_MONTH_OF_YEAR": prefer_month,
"RELATIVE_BASE": today,
}
)
self.when_date_is_parsed(date_string)
self.then_date_was_parsed_by_date_parser()
Expand Down

0 comments on commit 3de1fb2

Please sign in to comment.