37,720
社区成员
发帖
与我相关
我的任务
分享
def trans_login(name, password):
u = db.GetUser(name)
if u:
if u.checkPass(password):
u.setStatus(S_LOGIN)
return True
else:
raise ServiceException, "Password Error!"
else:
raise ServiceException, "User is not Existed!"
try:
this_Function_Need_to_Raise_Exception()
assert(False, "An exception should have been raised")
except ExpectedException:
assert(True, "I've been waiting for you, ex")
except Exception:
assert(False, "No, not you.")