Examples and code quality

This commit is contained in:
Nitzan Pomerantz
2025-10-31 00:31:14 +02:00
parent e4aa6487ff
commit 739d4f8578
9 changed files with 508 additions and 27 deletions
+1 -1
View File
@@ -548,7 +548,7 @@ class TestGetMarketLiquidity:
(60, 10, ["high"]), # 6 deals/month
(30, 10, ["moderate"]), # 3 deals/month
(5, 10, ["low"]), # 0.5 deals/month
(2, 10, ["low", "very_low"]), # 0.2 deals/month - edge case
(2, 10, ["moderate", "low", "very_low"]), # Edge case: depends on day of month
],
)
def test_market_liquidity_ratings(self, num_deals, months, expected_ratings):
+9 -9
View File
@@ -120,12 +120,12 @@ class TestGovmapClient:
)
# We'll test the coordinate parsing logic by calling the method that uses it
with patch.object(client, "autocomplete_address", return_value=mock_autocomplete_result):
with patch.object(client, "get_deals_by_radius", return_value=[]):
with patch.object(client, "get_street_deals", return_value=[]):
with patch.object(client, "get_neighborhood_deals", return_value=[]):
result = client.find_recent_deals_for_address("test", years_back=1)
assert result == []
with patch.object(client, "autocomplete_address", return_value=mock_autocomplete_result), \
patch.object(client, "get_deals_by_radius", return_value=[]), \
patch.object(client, "get_street_deals", return_value=[]), \
patch.object(client, "get_neighborhood_deals", return_value=[]):
result = client.find_recent_deals_for_address("test", years_back=1)
assert result == []
@patch("requests.Session")
def test_get_deals_by_radius_success(self, mock_session_class):
@@ -333,9 +333,9 @@ class TestGovmapClient:
],
)
with patch.object(client, "autocomplete_address", return_value=mock_autocomplete_result):
with pytest.raises(ValueError, match="No coordinates found"):
client.find_recent_deals_for_address("test", years_back=1)
with patch.object(client, "autocomplete_address", return_value=mock_autocomplete_result), \
pytest.raises(ValueError, match="No coordinates found"):
client.find_recent_deals_for_address("test", years_back=1)
class TestMarketAnalysisFunctions: