]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-150633: Minor improvement of a newly added test (#151103)
authorBarry Warsaw <barry@python.org>
Mon, 8 Jun 2026 19:21:00 +0000 (12:21 -0700)
committerGitHub <noreply@github.com>
Mon, 8 Jun 2026 19:21:00 +0000 (19:21 +0000)
Minor improvement of a newly added test.

Lib/test/test_import/__init__.py

index f8e77fc7c532c4ba2b0313a74a5f2c6094e08899..9f3df8010d3233956fd8affc404ec336f5664f71 100644 (file)
@@ -367,11 +367,11 @@ class ImportTests(unittest.TestCase):
     def test_import_null_byte_in_name_raises_ModuleNotFoundError(self):
         # gh-150633: module names containing null bytes should not
         # lead to duplicates in sys.modules
-        before = set(sys.modules.keys())
+        before = set(sys.modules)
         with self.assertRaises(ModuleNotFoundError):
             __import__('zipimport\x00junk')
 
-        self.assertEqual(set(sys.modules.keys()), before)
+        self.assertEqual(set(sys.modules), before)
 
     def test_from_import_missing_module_raises_ModuleNotFoundError(self):
         with self.assertRaises(ModuleNotFoundError):