mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-11-02 13:12:50 +00:00
fix(job_key): keep the bare basis for an empty title whose URL has no six-digit run (#523)
The mixed-script rule from #514 appended the digest to `basis` as well, so an empty title with a URL that carries no six-digit run moved from "acme_https-example-com-jobs-abc-xyz" to "..._5ca8c6". Unreachable from /scrape, which always passes a title, but a key is a pure function of the posting and should not move for a case the rule was never about. A lossy fragment still takes the digest; an empty title keeps the bare basis or "untitled-<hash>" exactly as before #514. One new case pins the pre-#514 output and fails on current master. The CHANGELOG example for the Python-разработчик key is corrected to its real digest (python-fb29d7). Follow-up suggested in the #514 merge note.
This commit is contained in:
1 parent
760bbc34cf
commit
da2aee7bf1
3 files changed
+23
-3
No files matched your search
@@ -142,6 +142,19 @@ class MixedScriptNamesKeepTheirIdentity(unittest.TestCase):
|
||||
b = make_key("сбер ai", "ML Engineer", url="https://example.com/2")
|
||||
self.assertEqual(a.split("_", 1)[0], b.split("_", 1)[0])
|
||||
|
||||
def test_empty_title_with_a_non_numeric_url_keeps_its_pre_fragment_key(self):
|
||||
# The fragment rule must not reach past its own case: an empty title
|
||||
# with a URL that carries no six-digit run keyed on the URL-derived
|
||||
# basis alone before #514, and the first cut of the rule had started
|
||||
# appending the digest there too. Unreachable from /scrape, which always
|
||||
# passes a title, but the key is a pure function of the posting and
|
||||
# should not move for a case the rule was never about.
|
||||
self.assertEqual(
|
||||
make_key("Acme", "", url="https://example.com/jobs/abc-xyz"),
|
||||
"acme_https-example-com-jobs-abc-xyz",
|
||||
)
|
||||
self.assertTrue(make_key("Acme", "", url="").startswith("acme_untitled-"))
|
||||
|
||||
def test_latin_names_with_accents_and_ligatures_are_not_lossy(self):
|
||||
# NFKD folds these without dropping a letter, so existing keys stay put.
|
||||
self.assertEqual(make_key("Zürich Versicherung", "Ingénieur finance"), "zurich-versicherung_ingenieur-finance")
|
||||
|
||||
Reference in new issue
Block a user