When you write some scripts that are self sufficient, is it a bad idea to use the if __name__ == '__main__' as a place to write tests?
When you write some scripts that are self sufficient, is it a bad idea
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Test logic and tests should never be part of “production” (production can mean in use by you, released to client, etc.) code. So, it is a bad idea to have them anywhere within your script.
Ideally, have them in separate files.