Skip to content

Conversation

@markk
Copy link
Contributor

@markk markk commented May 29, 2025

Fixes cases when searching only for a weekday where the parser had found the correct date but then erroneously "corrected" the month later.

Fixes #1266
Fixes #1249
Fixes #1243
Fixes #1202

Mark Knoop added 3 commits May 28, 2025 08:38
In the german search test, "Die" whould return the nearest Tuesday to
the RELATIVE_BASE date of 2000-01-01. This date is 1999-12-28. The test
was set to expect 1999-01-28, 11 months earlier, and not a Tuesday.

    December 1999         January 2000
Mo Tu We Th Fr Sa Su  Mo Tu We Th Fr Sa Su
       1  2  3  4  5                  1  2
 6  7  8  9 10 11 12   3  4  5  6  7  8  9
13 14 15 16 17 18 19  10 11 12 13 14 15 16
20 21 22 23 24 25 26  17 18 19 20 21 22 23
27 28 29 30 31        24 25 26 27 28 29 30
                      31
For a weekday search in `_correct_for_time_frame`, the parser object has
no `_token_month` set. Leaving this unset after a weekday date is found
allowed the month to be erroneously "corrected" by `_correct_for_month`
which alters the month by default to the month of the `RELATIVE_BASE` date.

We should instead set `_token_month` to that of the date found.

Fixes scrapinghub#1266
Fixes scrapinghub#1249
Fixes scrapinghub#1243
Fixes scrapinghub#1202
@codecov
Copy link

codecov bot commented May 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.47%. Comparing base (e9324ee) to head (117fdd5).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1274   +/-   ##
=======================================
  Coverage   97.47%   97.47%           
=======================================
  Files         234      234           
  Lines        2775     2776    +1     
=======================================
+ Hits         2705     2706    +1     
  Misses         70       70           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Gallaecio Gallaecio merged commit 180e697 into scrapinghub:master May 29, 2025
34 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants