def test_getTime(): assert pd.getTime("16:30") == time(16, 30)
def test_getTime_ValueError(): with pytest.raises(ValueError): pd.getTime("25:30")
def test_getLastDigitLicPlate_ValueError(): with pytest.raises(ValueError): pd.getLastDigitLicPlate("as23344")
def test_getLastDigitLicPlate(): assert pd.getLastDigitLicPlate("ABC5612") == 2
def test_getDate_ValueError(): with pytest.raises(ValueError): pd.getDate("13-13-2020")
def test_getDate(): assert pd.getDate("07-10-2020") == datetime(2020, 10, 7)
import Source.Parsing_Data as pd import Source.Pico_Placa as pp info = """Welcome to Pico & Placa Predictor:\n Format Plate Number Example: ABC0291\n Format Date: DD-MM-YYYY or DD/MM/YYYY or DD MM YYYY\n Formate Time: HH:MM or HH MM or HHhMM""" print(info) while True: try: licensePlate = input("Enter a license plate number: ") lastDigitLicPlate = pd.getLastDigitLicPlate(licensePlate) break except ValueError: print("Please, type a valid license plate number!") while True: try: date = pd.getDate(input("Enter a date: ")) break except ValueError: print("Please, type a valid date!") while True: try: timeGiven = pd.getTime(input("Especify a time: ")) break except ValueError: print("Please, especify a valid time!")