def chosen_option(): # Handling data entry in all cases menu() option_menu = chosen_option_menu() if option_menu == '1': menu_fuel() lv = liter_or_value() if lv == 1: menu_comb_id() FuelPump().byvalue(id_comb(), getting_value()) elif lv == 2: menu_comb_id() FuelPump().byliter(id_comb(), getting_value()) elif lv == 3: return chosen_option() elif option_menu == '2': title('REGISTRATION') line() Client().client_register(getting_cpf(), getting_name(), getting_phone()) elif option_menu == '3': title('CONSULTING POINTS') line() Fidelity().consulting_points(str(getting_cpf())) elif option_menu == '4': title('NF CONSULTATIONS') line() Nf().consulting_nf(getting_id_nf()) elif option_menu == '5': while True: print('See you soon!') break
def setUp(self): self.fuel_pump = FuelPump(capacity=5000, price_per_liter=3.00)
class FuelPumpTest(unittest.TestCase): def setUp(self): self.fuel_pump = FuelPump(capacity=5000, price_per_liter=3.00) def it_has_a_capacity(self): self.fuel_pump.capacity |should| equal_to(5000) def it_has_a_price_per_liter(self): self.fuel_pump.price_per_liter |should| close_to(3, delta=0.0001) def it_has_initially_zero_fuel(self): self.fuel_pump.fuel_count |should| close_to(0, delta=0.00001) def it_can_be_filled(self): self.fuel_pump.fill() self.fuel_pump.fuel_count |should| close_to(5000, delta=0.00001) def it_can_fuel_by_value(self): self.fuel_pump.fill() self.fuel_pump.fuel_by_value(90) |should| close_to(30.00, delta=0.0001) self.fuel_pump.fuel_count |should| close_to(4970, delta=0.0001) def it_raises_error_for_insufficient_fuel(self): self.fuel_pump.fill() (self.fuel_pump.fuel_by_value, 15001) |should| throw(InsufficientFuel) def it_can_fuel_by_liters(self): self.fuel_pump.fill() self.fuel_pump.fuel_by_liters(10) |should| close_to(30, delta=0.0001) self.fuel_pump.fuel_count |should| close_to(4990, delta=0.0001) def it_raises_error_for_insufficient_fuel(self): self.fuel_pump.fill() (self.fuel_pump.fuel_by_liters, 5001) |should| throw(InsufficientFuel)