bpo-43901: Upgrade test to use cool module reloading tech. by larryhastings · Pull Request #25752 · python/cpython
import sys
def test_annotations_are_created_correctly(self): from test import ann_module4 self.assertTrue("__annotations__" in ann_module4.__dict__) del ann_module4.__annotations__ self.assertFalse("__annotations__" in ann_module4.__dict__) for i in range(3): ann_module4 = import_helper.import_fresh_module("test.ann_module4") self.assertTrue("__annotations__" in ann_module4.__dict__) del ann_module4.__annotations__ self.assertFalse("__annotations__" in ann_module4.__dict__)
# frozen and namespace module reprs are tested in importlib.