mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-11-02 13:12:50 +00:00
fix(verify_pdf): --ascii-dates needs digit boundaries around the year (#512)
_YEAR matched (19|20)\d{2} anywhere, so `2000` inside `120000` or `12000`
made a budget or throughput range typed with `--` read as an en-dashed
date range: "Grew budget DKK 120000-200000" and "12000-15000 events/s"
both failed /apply Step 5d, and the agent was sent to fix a date argument
that does not exist. The guide promises a numeric range with no year is
left alone.
Bound the year with (?<!\d) and (?!\d). "2016-2024" next to a longer
number is still caught. Two new cases; the numeric one fails on the
unbounded pattern.
This commit is contained in:
1 parent
27a9b4a91d
commit
52f84e0f82
3 files changed
+21
-1
No files matched your search
@@ -99,6 +99,16 @@ class FindNonAsciiDateRangesTests(unittest.TestCase):
|
||||
# 05-cv-templates.md keeps `--` in prose ranges like EUR 600k--1M.
|
||||
self.assertEqual(find_non_ascii_date_ranges("EUR 600k\u20131M, 12\u201315 people"), [])
|
||||
|
||||
def test_year_like_digits_inside_a_longer_number_are_not_a_year(self):
|
||||
# `2000` sits inside `120000`, `200000`, `12000`, `15000`: a budget or
|
||||
# throughput range typed with `--` is not a date and must not fail 5d.
|
||||
for text in ("Grew budget DKK 120000\u2013200000", "Scaled ingestion from 12000\u201315000 events/s"):
|
||||
with self.subTest(text=text):
|
||||
self.assertEqual(find_non_ascii_date_ranges(text), [])
|
||||
|
||||
def test_a_standalone_year_next_to_a_longer_number_is_still_caught(self):
|
||||
self.assertEqual(find_non_ascii_date_ranges("2016\u20132024 (120000 users)")[0][1], "\u2013")
|
||||
|
||||
def test_year_ending_a_line_is_not_joined_to_the_next_lines_dash(self):
|
||||
text = "Heading 1988-1994\n\u2013 note\n"
|
||||
self.assertEqual(find_non_ascii_date_ranges(text), [])
|
||||
|
||||
Reference in new issue
Block a user