def startshop(): while 1 == True: shop = BikeRental(100) customer = Customer() print(""" ====== Bike Rental Shop ======= 1. Display available bikes 2. Request a bike on hourly basis $5 3. Request a bike on daily basis $20 4. Request a bike on weekly basis $60 5. Return a bike 6. Exit """) choice = input("Enter choice: ") try: choice = int(choice) except ValueError: print("That's not an int!") pass if choice == 1: shop.displaystock() elif choice == 2: customer.rentalTime = shop.rentBikeOnHourlyBasis(customer.requestBike()) customer.rentalBasis = 1 elif choice == 3: customer.rentalTime = shop.rentBikeOnDailyBasis(customer.requestBike()) customer.rentalBasis = 2 elif choice == 4: customer.rentalTime = shop.rentBikeOnWeeklyBasis(customer.requestBike()) customer.rentalBasis = 3 elif choice == 5: customer.bill = shop.returnBike(customer.returnBike()) customer.rentalBasis, customer.rentalTime, customer.bikes = 0,0,0 elif choice == 6: clear() print(""" ====== Bike Rental Shop ======= Thank you for using the bike rental system. """) sleep(2) clear() exit() else: print("Invalid input. Please enter number between 1-6 ")
def test_rentBikeOnDailyBasis_for_invalid_positive_number_of_bikes(self): print("\nRent Bike Daily Not enough stock !") shop = BikeRental(10) self.assertEqual(shop.rentBikeOnDailyBasis(11), None)
def test_rentBikeOnDailyBasis_for_valid_positive_number_of_bikes(self): print("\nRent Bike Daily Success!") shop = BikeRental(10) hour = datetime.now().hour self.assertEqual(shop.rentBikeOnDailyBasis(2).hour, hour)
def test_rentBikeOnDailyBasis_for_zero_number_of_bikes(self): print("\nRent Bike Daily zero bike!") shop = BikeRental(10) self.assertEqual(shop.rentBikeOnDailyBasis(0), None)
def test_rentBikeOnDailyBasis_for_negative_number_of_bikes(self): print("\nRent Bike Daily neg bike!") shop = BikeRental(10) self.assertEqual(shop.rentBikeOnDailyBasis(-1), None)
def test_rentBikeOnDailyBasis_for_invalid_positive_number_of_bikes(self): shop = BikeRental(10) self.assertEqual(shop.rentBikeOnDailyBasis(11), None)