def test_does_not_accept_guest_in_occupied_room(): hotel = Hotel() hotel.check_in('Bob Barker', 303) assert(hotel.check_in('Roy Orbison', 303) == False)
def test_check_in_a_guest(): hotel = Hotel() hotel.check_in('Bob Barker', 302) assert(('Bob Barker' in hotel.guests()) == True)
def test_check_out_a_guest_releases_room(): hotel = Hotel() hotel.check_in('Jim Maui', 301) hotel.check_out('Jim Maui')
def test_check_out_a_guest(): hotel = Hotel() hotel.check_in('Bob Dylan', 306) hotel.check_out('Bob Dylan') assert(('Bob Dylan' in hotel.guests()) == False)
def test_accepts_guest_into_unoccupied_room(): hotel = Hotel() hotel.check_in('Bob Barker', 303) assert(hotel.check_in('Roy Orbison', 305) == True)
from hotel import Hotel print("Enter the name of the hotel:", end=" ") hotel = Hotel(input()) hotel.list_rooms() while hotel.has_vacancy(): occupant_name = input("Enter name of guest to check in: ") room_name = input("Enter the room name: ") retry = True while retry: if hotel.is_room_exist(room_name): if hotel.has_vacancy(room_name): hotel.check_in(room_name, occupant_name) retry = False else: room_name = input("Room is full, Try another room ") else: room_name = input("Room doesn't exist, Try another room ") hotel.list_rooms() print(f"All rooms in hotel {hotel.name} are full")