Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Please help me do a unittest for the following: class event : """inheritnce from define_Event class""" def __init__ ( self , event_name , event_date , event_time , event_type ): """Define the event...

1 answer below »
Please help me do a unittest for the following:

class event:
"""inheritnce from define_Event class"""
def __init__(self, event_name, event_date, event_time, event_type):
"""Define the event class"""
self.eventname = event_name
self.eventdate = event_date
self.eventtime = event_time
self.eventtype = event_type
def displayinformation(self):
print(f"\n\nEvent name : {self.eventname} \nEvent Date : {self.eventdate} \tEvent Time : {self.eventtime} \tEvent Type : {self.eventtype}")
def ename_valid(event_name):
"""
Checks event_name to ensure it is within the appropriate characters
Arguement:
If event_name input is blank or not alpha, it asks for the info again
Else, It passes through the validation check
Returns:
Validated Valid Event Name
"""
if event_name:
for character in event_name:
if character.isalpha():
return True
else:
print("Event name must contains only characters only, please try again: ")
return False
else:
print("Error: Blank Event Name provided.")
return False
def edate_valid(event_date):
"""
Checks event_date to ensure it is within the appropriate characters
Arguement:
If event_date input is blank or not digit/numbers, it asks for the info again
Else, It passes through the validation check
Returns:
Validated Valid Event Date
"""
if event_date:
for character in event_date:
if character.isdigit() or character == '-':
return True
else:
print("Event date must contains only numbers and the - symbo, please try again: ")
return False
else:
print("Error: Blank Event Date provided.")
return False
def etime_valid(event_time):
"""
Checks event_time to ensure it is within the appropriate characters
Arguement:
If event_time input is blank or not digits or missing the symbol ':', it asks for the info again
Else, It passes through the validation check
Returns:
Validated Valid Event Time
"""
if event_time:
for character in event_time:
if character.isdigit() or character == ':':
return True
else:
print("Event time must contains only numbers and the : symbol, please try again: ")
return False
else:
print("Error: Blank Event Date provided.")
return False
def etype_valid(event_type):
"""
Checks event_type to ensure it is within the appropriate characters
Arguement:
If event_type input is blank or not one of the three options listed else, it asks for the info again
Else, It passes through the validation check
Returns:
Validated Valid Event Type
"""
if event_type == 's':
event_type = 'single occurrence'
return event_type
elif event_type == 'r':
event_type = 'recurring'
return event_type
elif event_type == 'f':
event_type = 'Fixed number of meetings'
return event_type
else:
print("Invalid input please select one of the three options")
return False

Answered Same Day Aug 15, 2022

Solution

Dikchha answered on Aug 15 2022
69 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here