예제 #1
0
 def test_properties_sale_agreed(self):
     daft = Daft()
     daft.set_county("Dublin City")
     daft.set_area("Dublin 15")
     daft.set_listing_type(SaleType.PROPERTIES)
     daft.set_sale_agreed(True)
     listings = daft.search()
     self.assertTrue(len(listings) > 0)
예제 #2
0
    def test_properties_sale_agreed_with_price(self):
        daft = Daft()
        daft.set_county("Dublin City")
        daft.set_area("Dublin 15")
        daft.set_listing_type(SaleType.PROPERTIES)
        daft.set_min_price(200000)
        daft.set_max_price(250000)
        daft.set_sale_agreed(True)
        listings = daft.search(fetch_all=False)

        self.assertTrue(len(listings) > 0)
        listing = listings[0]
        price = listing.price
        self.assertTrue(200000 <= int(price) <= 250000)
        self.assertTrue("Dublin 15" in listing.formalised_address)
예제 #3
0
    def test_properties_sale_agreed_with_invalid_prices(self):
        daft = Daft()
        raised_exception = False
        daft.set_county("Dublin City")
        daft.set_area("Dublin 15")
        daft.set_listing_type(SaleType.PROPERTIES)
        daft.set_sale_agreed(True)

        try:
            daft.set_min_price("Two")
            daft.set_max_price("")
            daft.search()
        except:
            raised_exception = True

        self.assertTrue(raised_exception)
예제 #4
0
    def test_properties_sale_agreed_with_price(self):
        daft = Daft()
        daft.set_county("Dublin City")
        daft.set_area("Dublin 15")
        daft.set_listing_type(SaleType.PROPERTIES)
        daft.set_min_price(200000)
        daft.set_max_price(250000)
        daft.set_sale_agreed(True)
        listings = daft.get_listings()

        self.assertTrue(len(listings) > 0)
        listing = listings[0]
        price = listing.get_price()
        price = price[1:]
        price = price.replace(',', '')
        self.assertTrue(200000 <= int(price) <= 250000)
        self.assertTrue('Dublin 15' in listing.get_formalised_address())
# Get the current sale agreed prices for properties in Dublin 15 that are between 200,000 and 250,000.

from daftlistings import Daft, SaleType

daft = Daft()
daft.set_county("Dublin City")
daft.set_area("Dublin 15")
daft.set_listing_type(SaleType.PROPERTIES)
daft.set_sale_agreed(True)
daft.set_min_price(200000)
daft.set_max_price(250000)

listings = daft.get_listings()

for listing in listings:

    print(listing.get_formalised_address())
    print(listing.get_daft_link())

    facilities = listing.get_facilities()
    if facilities is not None:
        print('Facilities: ')

        for facility in facilities:
            print(facility)

    features = listing.get_features()
    if features is not None:
        print('Features: ')
        for feature in features:
            print(feature)