- single home return type bug fix

master v0.4.9
zachary 2025-05-05 12:29:36 -07:00
parent a3c5e9060e
commit 68a3438c6e
3 changed files with 14 additions and 8 deletions

View File

@ -121,7 +121,10 @@ class RealtorScraper(Scraper):
property_info = response_json["data"]["home"]
if self.return_type != ReturnType.raw:
return [self.process_property(property_info)]
else:
return [property_info]
@staticmethod
def process_advertisers(advertisers: list[dict] | None) -> Advertisers | None:

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "homeharvest"
version = "0.4.8"
version = "0.4.9"
description = "Real estate scraping library"
authors = ["Zachary Hampton <zachary@bunsly.com>", "Cullen Watson <cullen@bunsly.com>"]
homepage = "https://github.com/Bunsly/HomeHarvest"

View File

@ -292,11 +292,14 @@ def test_phone_number_matching():
def test_return_type():
results = {
"pandas": scrape_property(location="Surprise, AZ", listing_type="for_rent", limit=100),
"pydantic": scrape_property(location="Surprise, AZ", listing_type="for_rent", limit=100, return_type="pydantic"),
"raw": scrape_property(location="Surprise, AZ", listing_type="for_rent", limit=100, return_type="raw"),
"pandas": [scrape_property(location="Surprise, AZ", listing_type="for_rent", limit=100)],
"pydantic": [scrape_property(location="Surprise, AZ", listing_type="for_rent", limit=100, return_type="pydantic")],
"raw": [
scrape_property(location="Surprise, AZ", listing_type="for_rent", limit=100, return_type="raw"),
scrape_property(location="66642", listing_type="for_rent", limit=100, return_type="raw"),
],
}
assert isinstance(results["pandas"], pd.DataFrame)
assert isinstance(results["pydantic"][0], Property)
assert isinstance(results["raw"][0], dict)
assert all(isinstance(result, pd.DataFrame) for result in results["pandas"])
assert all(isinstance(result[0], Property) for result in results["pydantic"])
assert all(isinstance(result[0], dict) for result in results["raw"])