Backend doctype script not executing

Hi,
I am following the following tutorial
https://frappeframework.com/docs/user/en/tutorial/types-of-doctype

I edited the library_membership.py with validation code as mentioned in the tutorial.
I entered the data in a way that should throw the message in the script and save.
But when i submit the librarymembership record, the script is not executing ie., the message is not showing up.