+
    p3-j                         ^ RI t ^ RIHtHtHtHtHt  ! R R] P                  4      t]	R8X  d   ] P                  ! 4        R# R# )    N)build_queriesextract_priceparse_bing_rss_resultsparse_duckduckgo_resultsscore_resultc                   >   a  ] tR t^t o R tR tR tR tR tRt	V t
R# )ScraperTestsc                   \        R ^RRR7      pV P                  \        V4      ^4       RP                  V4      pV P	                  R V4       V P	                  RV4       V P	                  RV4       V P	                  RV4       R# )	Montpellier maisoncenter	radius_km	max_priceproperty_type
zCastelnau-le-LezLattesu   maison à vendreN)r   assertGreaterEquallenjoinassertIn)selfqueriesjoineds   &  7/home/wildlama/real-estate-finder/tests/test_scraper.py2test_build_queries_includes_montpellier_ring_towns?ScraperTests.test_build_queries_includes_montpellier_ring_towns   so    }fdlmGa07#mV,(&1h'(&1    c                   R p\        V4      pV P                  \        V4      ^4       V P                  V^ ,          R,          R4       V P                  V^ ,          R,          R4       V P                  RV^ ,          R,          4       V P                  V^,          R,          R4       V P                  V^,          R,          R4       R	# )
u  
        <html><body>
          <a rel="nofollow" class="result__a" href="//duckduckgo.com/l/?uddg=https%3A%2F%2Fexample.com%2Flisting1">Maison Montpellier 340000</a>
          <a rel="nofollow" class="result__snippet">Belle maison 4 pièces, jardin, Montpellier.</a>
          <a rel="nofollow" class="result__a" href="//duckduckgo.com/l/?uddg=https%3A%2F%2Fexample.com%2Flisting2">Villa proche Lattes</a>
          <a rel="nofollow" class="result__snippet">400 000 € max, 15 km de Montpellier.</a>
        </body></html>
        titlezMaison Montpellier 340000urlzhttps://example.com/listing1jardinsnippetzVilla proche Latteszhttps://example.com/listing2N)r   assertEqualr   r   )r   htmlresultss   &  r   =test_parse_duckduckgo_results_extracts_title_link_and_snippetJScraperTests.test_parse_duckduckgo_results_extracts_title_link_and_snippet   s     +40Wq)G,.IJE*,JKh
9 56G,.CDE*,JKr   c                   R p\        V4      pV P                  \        V4      ^4       V P                  V^ ,          R,          R4       V P                  V^ ,          R,          R4       V P                  RV^ ,          R,          4       R# )u  
        <rss version="2.0">
          <channel>
            <item>
              <title>Maison à vendre Montpellier</title>
              <link>https://example.com/1</link>
              <description>Maison 390 000 € près de Castelnau-le-Lez</description>
            </item>
            <item>
              <title>Villa à vendre Lattes</title>
              <link>https://example.com/2</link>
              <description>400k€ max</description>
            </item>
          </channel>
        </rss>
        r!   u   Maison à vendre Montpellierr"   zhttps://example.com/1	Castelnaur$   N)r   r%   r   r   )r   xmlr'   s   &  r   ,test_parse_bing_rss_results_extracts_entries9ScraperTests.test_parse_bing_rss_results_extracts_entries!   st      )-Wq)G,.LME*,CDk71:i#89r   c                    V P                  \        R 4      R4       V P                  \        R4      R4       V P                  \        R4      4       R# )u!   Maison à 399 000 € avec jardini u   Prix: 400k€r   zPrix sur demandeN)r%   r   assertIsNone)r   s   &r   #test_extract_price_supports_formats0ScraperTests.test_extract_price_supports_formats8   sA    'JKVT7@-(:;<r   c                ^    R RRRRRRR/p\        VR^R	R
R7      pV P                  V^ 4       R# )r!   zMaison Montpellierr$   u$   À 12 km de Montpellier, 390 000 €r"   zhttps://example.comsourcePAPr   r   r   r   N)r   assertGreater)r   resultscores   &  r   2test_score_result_prefers_price_and_distance_match?ScraperTests.test_score_result_prefers_price_and_distance_match=   sF    )=(e	
 VMRSYiqr5!$r    N)__name__
__module____qualname____firstlineno__r   r(   r-   r1   r9   __static_attributes____classdictcell__)__classdict__s   @r   r	   r	      s$     2L":.=
% %r   r	   __main__)unittestreal_estate_agent.scraperr   r   r   r   r   TestCaser	   r<   mainr;   r   r   <module>rH      s?     C  C?%8$$ ?%D zMMO r   