I am trying to enter the exception part after the try statement. Here is my code
user_date = user.datetime
try:
user_date == None
print(user_date)
except Exception as e:
raise Unauthorized(f"Not a date")
the print statement returns 2022-08-22 18:12:53.409212
so that is working correctly. But that means user_date does not equal none. Shouldn't this enter the exception
?
Expected output is that it enters the exception
since user_date = user.datetime is not None
I would use an if statement except I need to raise an exception without exiting the function.
Thanks in advance.