From 653f1f9c05b6cdc386627b07f2e81ffe112db3d5 Mon Sep 17 00:00:00 2001 From: anthony sottile Date: Tue, 22 Sep 2026 17:00:14 -0400 Subject: [PATCH] add test for submodule import redefining a name --- pyflakes/test/test_imports.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyflakes/test/test_imports.py b/pyflakes/test/test_imports.py index bfad5812..982e6daf 100644 --- a/pyflakes/test/test_imports.py +++ b/pyflakes/test/test_imports.py @@ -841,6 +841,13 @@ def test_duplicateSubmoduleImport(self): fu.bar ''', m.RedefinedWhileUnused) + def test_submodule_import_redefines_name(self): + self.flakes(''' + def f(): pass + import f.x + f.x + ''', m.RedefinedWhileUnused) + def test_differentSubmoduleImport(self): """ If two different submodules of a package are imported, no duplicate