fix(realestate-collector): district regex tolerates missing separator
This commit is contained in:
@@ -21,7 +21,7 @@ DETAIL_ENDPOINTS = [
|
|||||||
("getOPTLttotPblancDetail", "getOPTLttotPblancMdl"),
|
("getOPTLttotPblancDetail", "getOPTLttotPblancMdl"),
|
||||||
]
|
]
|
||||||
|
|
||||||
DISTRICT_PATTERN = re.compile(r"(?:서울특별시|서울시|서울)\s+(\S+?(?:구|군))")
|
DISTRICT_PATTERN = re.compile(r"(?:서울특별시|서울시|서울)\s*(\S+?(?:구|군))")
|
||||||
|
|
||||||
|
|
||||||
def _extract_district(parsed: Dict[str, Any]) -> str | None:
|
def _extract_district(parsed: Dict[str, Any]) -> str | None:
|
||||||
|
|||||||
@@ -110,6 +110,13 @@ def test_collect_stores_district_for_seoul_announcement(monkeypatch):
|
|||||||
assert row["status"] in ("청약예정", "청약중")
|
assert row["status"] in ("청약예정", "청약중")
|
||||||
|
|
||||||
|
|
||||||
|
def test_extract_district_no_separator():
|
||||||
|
"""주소에 공백이 없어도 자치구를 추출해야 한다."""
|
||||||
|
from app.collector import _extract_district
|
||||||
|
parsed = {"address": "서울특별시강남구도곡동", "region_name": None}
|
||||||
|
assert _extract_district(parsed) == "강남구"
|
||||||
|
|
||||||
|
|
||||||
def test_collect_passes_date_window_param(monkeypatch):
|
def test_collect_passes_date_window_param(monkeypatch):
|
||||||
from app import collector
|
from app import collector
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user