@@ -48,18 +48,31 @@ def test_shadowed_format_call(self):
4848 messages = self ._run_pylint (code )
4949 errors = [msg for msg in messages if msg .msg_id == "E0611" ]
5050 self .assertEqual (len (errors ), 0 )
51-
51+
5252 def test_early_module_yield (self ):
53- code = "import my_module.utils as my_module\n my_module.other_method()\n "
53+ code = """
54+ import my_module.utils as my_module
55+ x = my_module.other_method()
56+ y = [my_module.format() for _ in range(1)]
57+ """
58+ messages = self ._run_pylint (code )
59+ errors = [msg for msg in messages if msg .msg_id == "E0611" ]
60+ self .assertEqual (len (errors ), 0 )
61+
62+ def test_nested_shadowed_imports (self ):
63+ code = """
64+ import my_module.submodule.utils as my_module
65+ my_module.format()
66+ """
5467 messages = self ._run_pylint (code )
5568 errors = [msg for msg in messages if msg .msg_id == "E0611" ]
56- self .assertEqual (len (errors ), 0 , f"Unexpected error: { errors } " )
57-
69+ self .assertEqual (len (errors ), 0 )
70+
5871 def test_access_module_dict (self ):
5972 code = "import my_module.utils as utils\n print(utils.__dict__)\n "
6073 messages = self ._run_pylint (code )
6174 errors = [msg for msg in messages if msg .msg_id == "E0611" ]
62- self .assertEqual (len (errors ), 0 , f"Should allow __dict__ access: { errors } " )
75+ self .assertEqual (len (errors ), 0 )
6376
6477 def test_non_shadowed_import (self ):
6578 code = "import my_module.utils as utils\n utils.format()\n "
0 commit comments