Пример #1
0
    def test_calculate_cheapest_hotel_equal_stars_reward_customer(self):
        hotel1 = Hotel('hotel1', 3, 70, 60, 90, 50)  # 60+50+50 = 160
        hotel2 = Hotel('hotel2', 3, 85, 35, 110, 90)  # 35+90+90 = 215
        hotel3 = Hotel('hotel3', 3, 68, 65, 50, 45)  # 65+45+45 = 155

        dates = [
            datetime(2019, 11, 1),
            datetime(2019, 11, 2),
            datetime(2019, 11, 3)
        ]

        hotel_chain = HotelChain()
        hotel_chain.add_hotel(hotel1)
        hotel_chain.add_hotel(hotel2)
        hotel_chain.add_hotel(hotel3)

        self.assertEqual(hotel_chain.calculate_cheapest_hotel(dates, 'Reward'),
                         'hotel3')
Пример #2
0
    def test_calculate_cheapest_hotel_different_stars_regular_customer(self):
        hotel1 = Hotel('hotel1', 5, 60, 60, 50, 50)  # 60+50+50   = 160
        hotel2 = Hotel('hotel2', 3, 85, 35, 110, 90)  # 85+110+110 = 305
        hotel3 = Hotel('hotel3', 4, 68, 65, 50, 45)  # 68+50+50   = 168

        dates = [
            datetime(2019, 11, 1),
            datetime(2019, 11, 2),
            datetime(2019, 11, 3)
        ]

        hotel_chain = HotelChain()
        hotel_chain.add_hotel(hotel1)
        hotel_chain.add_hotel(hotel2)
        hotel_chain.add_hotel(hotel3)

        self.assertEqual(
            hotel_chain.calculate_cheapest_hotel(dates, 'Regular'), 'hotel1')
Пример #3
0
 def test_calculate_fee_with_blackout_days(self):
     hotel = Hotel('Hotel 2', 5, 150, 120, 190, 150, [datetime(2019, 12, 25)])
     customer = Customer('Customer 2', 'Rewards')
     date_list = [datetime(2019, 12, 25), datetime(2019, 12, 26)]
     self.assertEqual(hotel.calculate_total_fee(date_list, customer.category), 270)
Пример #4
0
 def test_calculate_number_of_reward_days(self):
     hotel = Hotel('Hotel 3', 5, 150, 100, 150, 120, [datetime(2019, 12, 25)])
     number_reward_days = hotel.is_blackout_day(datetime(2019, 12, 25))
     self.assertEqual(number_reward_days, True)
Пример #5
0
 def test_calculate_fee_for_mixed_days_day_reward_customer(self):
     hotel = Hotel('Hotel 2', 5, 150, 120, 190, 150)
     customer = Customer('Customer 2', 'Rewards')
     date_list = [datetime(2019, 11, 1), datetime(2019, 11, 2)]
     self.assertEqual(hotel.calculate_total_fee(date_list, customer.category), 270)
Пример #6
0
 def test_calculate_fee_for_mixed_days_day_regular_customer(self):
     hotel = Hotel('Hotel 1', 3, 100, 90, 150, 100)
     customer = Customer('Customer 1', 'Regular')
     date_list = [datetime(2019, 11, 1), datetime(2019, 11, 2)]
     self.assertEqual(hotel.calculate_total_fee(date_list, customer.category), 250)
Пример #7
0
 def test_calculate_fee_for_zero_days_regular_customer(self):
     hotel = Hotel('Hotel 1', 3, 100, 90, 150, 100)
     customer = Customer('Customer 1', 'Regular')
     date_list = []
     self.assertEqual(hotel.calculate_total_fee(date_list, customer.category), 0)
Пример #8
0
 def test_calculate_fee_for_one_weekend_day_reward_customer(self):
     hotel = Hotel('Hotel 1', 3, 100, 90, 150, 100)
     customer = Customer('Customer 2', 'Rewards')
     date_list = [datetime(2019, 11, 2)]
     self.assertEqual(hotel.calculate_total_fee(date_list, customer.category), 100)
Пример #9
0
 def test_calculate_fee_for_two_weekend_day_regular_customer(self):
     hotel = Hotel('Hotel 2', 5, 150, 120, 190, 150)
     customer = Customer('Customer 1', 'Regular')
     date_list = [datetime(2019, 11, 2), datetime(2019, 11, 3)]
     self.assertEqual(hotel.calculate_total_fee(date_list, customer.category), 380)
Пример #10
0
 def test_calculate_fee_for_zero_days_reward_customer(self):
     hotel = Hotel('Hotel 2', 5, 150, 120, 190, 150)
     customer = Customer('Customer 2', 'Rewards')
     date_list = []
     self.assertEqual(hotel.calculate_total_fee(date_list, customer.category), 0)