Fix: Address E2E bugs from real-world MCP testing
Fixes three critical bugs discovered during live testing with Claude: Bug #1: Same building detection always returned 0 - Root cause: deal.get('address') returned empty string - Fix: Construct address from streetNameHeb + houseNum fields - Added test: test_same_building_detection_with_api_fields Bug #2: Property type filter too strict - Root cause: Exact match failed for variants like 'דירת גג' - Fix: Use flexible substring matching with normalization Bug #3: Deal deduplication used non-existent field - Root cause: Deduplication key referenced deal.get('address') - Fix: Removed non-existent field from deduplication key Also added _calculate_distance() helper for future radius filtering. Test results: 26/28 passing (2 pre-existing failures unrelated) References: .cursor/plans/MCP-E2E-TEST-SUMMARY.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -525,3 +525,22 @@ class TestMarketAnalysisFunctions:
|
||||
assert stats["count"] == 3
|
||||
assert stats["price_stats"]["mean"] > 0
|
||||
assert stats["area_stats"]["mean"] == pytest.approx(80.0)
|
||||
|
||||
def test_same_building_detection_with_api_fields(self):
|
||||
"""Test same building detection with actual API field structure."""
|
||||
client = GovmapClient()
|
||||
|
||||
# Test that _is_same_building works with addresses constructed from API fields
|
||||
search_address = "חנקין 62"
|
||||
|
||||
# Deal from same building (should match)
|
||||
deal_address_same = "חנקין 62"
|
||||
assert client._is_same_building(search_address, deal_address_same) is True
|
||||
|
||||
# Deal from different building on same street (should not match)
|
||||
deal_address_different = "חנקין 50"
|
||||
assert client._is_same_building(search_address, deal_address_different) is False
|
||||
|
||||
# Deal from different street (should not match)
|
||||
deal_address_other_street = "בילינסון 6"
|
||||
assert client._is_same_building(search_address, deal_address_other_street) is False
|
||||
|
||||
Reference in New Issue
Block a user