Срез 0: скелет scan-gateway — без фронта и БД, горячие папки local/smb, воркер NATS без JetStream, эмулятор ИС Сканирование #3
@ -111,8 +111,10 @@ class TestRealFixtures:
|
|||||||
class TestFixtureLookup:
|
class TestFixtureLookup:
|
||||||
def test_exact_beats_prefix(self, tmp_path: Path) -> None:
|
def test_exact_beats_prefix(self, tmp_path: Path) -> None:
|
||||||
hf = _hotfolder(tmp_path)
|
hf = _hotfolder(tmp_path)
|
||||||
fixtures = _fixtures_dir(tmp_path, {"a.json": {"file_uid": "x", "v": "exact"}, "a0.json": {"v": "prefix"}})
|
# `a_b-1.json` по алфавиту раньше `a_b.json` ('-' 0x2D < '.' 0x2E): без шага «точное имя» победил бы префикс
|
||||||
job_id = _drop(hf, "a.pdf")
|
assert sorted(["a_b.json", "a_b-1.json"])[0] == "a_b-1.json"
|
||||||
|
fixtures = _fixtures_dir(tmp_path, {"a_b-1.json": {"v": "prefix"}, "a_b.json": {"file_uid": "x", "v": "exact"}})
|
||||||
|
job_id = _drop(hf, "a_b.pdf")
|
||||||
process_once(hf.root, fixtures, 0)
|
process_once(hf.root, fixtures, 0)
|
||||||
assert _answer(hf, job_id) == {"file_uid": job_id, "v": "exact"}
|
assert _answer(hf, job_id) == {"file_uid": job_id, "v": "exact"}
|
||||||
|
|
||||||
@ -120,7 +122,6 @@ class TestFixtureLookup:
|
|||||||
hf = _hotfolder(tmp_path)
|
hf = _hotfolder(tmp_path)
|
||||||
fixtures = _fixtures_dir(tmp_path, {"a_zz.json": {"v": "zz"}, "a_b.json": {"v": "b"}, "a_c.json": {"v": "c"}})
|
fixtures = _fixtures_dir(tmp_path, {"a_zz.json": {"v": "zz"}, "a_b.json": {"v": "b"}, "a_c.json": {"v": "c"}})
|
||||||
job_id = _drop(hf, "a.pdf")
|
job_id = _drop(hf, "a.pdf")
|
||||||
# `a_*` не совпадает с префиксом `a` по имени без расширения? совпадает: `a*.json`
|
|
||||||
process_once(hf.root, fixtures, 0)
|
process_once(hf.root, fixtures, 0)
|
||||||
assert _answer(hf, job_id)["v"] == "b"
|
assert _answer(hf, job_id)["v"] == "b"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user