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?
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.
Use if __name__ == '__main__': for tests