diff --git a/Lib/test/test_lazy_import/__init__.py b/Lib/test/test_lazy_import/__init__.py index a9a8cd143e0d75..b44e7d62bc9725 100644 --- a/Lib/test/test_lazy_import/__init__.py +++ b/Lib/test/test_lazy_import/__init__.py @@ -1948,6 +1948,13 @@ def test_normal_import_dis(self): else: self.assertFail("IMPORT_NAME not found") + def test_eager_import_dis(self): + """non module level import should show eager""" + code = compile("def f(): import foo", "exec", "exec") + f = io.StringIO() + dis.dis(code, file=f) + self.assertIn("foo + eager", f.getvalue()) + @unittest.skipIf(_testcapi is None, 'need the _testcapi module') class LazyCApiTests(unittest.TestCase):