コード例 #1
0
ファイル: hotel_test.py プロジェクト: joeryan/100days
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)
コード例 #2
0
ファイル: hotel_test.py プロジェクト: joeryan/100days
def test_check_in_a_guest():
  hotel = Hotel()
  hotel.check_in('Bob Barker', 302)
  assert(('Bob Barker' in hotel.guests()) == True)
コード例 #3
0
ファイル: hotel_test.py プロジェクト: joeryan/100days
def test_check_out_a_guest_releases_room():
  hotel = Hotel()
  hotel.check_in('Jim Maui', 301)
  hotel.check_out('Jim Maui')
コード例 #4
0
ファイル: hotel_test.py プロジェクト: joeryan/100days
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)
コード例 #5
0
ファイル: hotel_test.py プロジェクト: joeryan/100days
def test_accepts_guest_into_unoccupied_room():
  hotel = Hotel()
  hotel.check_in('Bob Barker', 303)
  assert(hotel.check_in('Roy Orbison', 305) == True)
コード例 #6
0
ファイル: main.py プロジェクト: alzed/python-warehouse
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")