First, we will explore the power of the Python __main__ self-testing section by adding this self-testing section to our LanguageResources.py module. Whenever we run a module that has this self-testing section located at the bottom of the module, when the module is executed by itself, this code will run.
When the module is imported and used from other modules, the code in the __main__ self-testing section will not be executed.
This is the code which is also shown in the screenshot that follows:
if __name__ == '__main__': language = 'en' inst = I18N(language) print(inst.title) language = 'de' inst = I18N(language) print(inst.title)
After adding the self-testing section can we now run this module by itself and it creates ...