Skip to content

Commit 51ddfe7

Browse files
committed
Add failing test
1 parent 6908372 commit 51ddfe7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Lib/test/test_lazy_import/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,20 @@ def test_lazy_value_resolve(self):
210210
import test.test_lazy_import.data.lazy_get_value
211211
self.assertIn("test.test_lazy_import.data.basic2", sys.modules)
212212

213+
@support.requires_subprocess()
214+
def test_lazy_value_resolve_method_exists_if_not_called(self):
215+
code = textwrap.dedent("""
216+
lazy import json
217+
print(globals()["json"].resolve)
218+
""")
219+
result = subprocess.run(
220+
[sys.executable, "-c", code],
221+
capture_output=True,
222+
text=True
223+
)
224+
self.assertEqual(result.returncode, 0, f"stdout: {result.stdout}, stderr: {result.stderr}")
225+
self.assertIn("<built-in method resolve of lazy_import object at", result.stdout)
226+
213227
def test_lazy_import_type_exposed(self):
214228
"""LazyImportType should be exposed in types module."""
215229
self.assertHasAttr(types, 'LazyImportType')

0 commit comments

Comments
 (0)