Question: run this example which illustrates unit testing using pythons unittest...
Run this example which illustrates unit testing using python's unittest module. Correct the problems with the code.
Suppose that valid email addresses need to the follow these rules:
- the address must contain one and only one @ character
- the string following the @ character MUST be abcSteel.com
- the string preceding the @ character must contain ONLY letters and optionally one period. It must be at least one letter.
if email.count('@') != 1: #email address MUST aheve exactly one @ character
tmpList = email.split('@') #create a list of 2 strings(username and mandated company name
if len(tmpList) == 2: #there must be a username AND a company name
userName = tmpList
for c in userName:
if not c.isalpha() and c!='.':
if inst !='abcSteel.com':