bpo-42955: Add sys.modules_names (GH-24238)

Add sys.module_names, containing the list of the standard library
module names.
This commit is contained in:
Victor Stinner 2021-01-25 13:24:42 +01:00 committed by GitHub
parent 879986d8a9
commit db584bdad3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 305 additions and 275 deletions

View file

@ -986,6 +986,11 @@ class SysModuleTest(unittest.TestCase):
self.assertEqual(proc.stdout.rstrip().splitlines(), expected,
proc)
def test_module_names(self):
self.assertIsInstance(sys.module_names, frozenset)
for name in sys.module_names:
self.assertIsInstance(name, str)
@test.support.cpython_only
class UnraisableHookTest(unittest.TestCase):