File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1028,6 +1028,8 @@ def test_setup_ignores_basic_completer_env_when_env_is_disabled(self):
10281028 class FakeFancyCompleter :
10291029 def __init__ (self , namespace ):
10301030 self .namespace = namespace
1031+ self .use_colors = Mock ()
1032+ self .theme = Mock ()
10311033
10321034 def complete (self , text , state ):
10331035 return None
@@ -1675,6 +1677,17 @@ def test_colorize_import_completions(self) -> None:
16751677 ])
16761678 self .assertIsNone (action )
16771679
1680+ # Make sure attributes take precedence over submodules when both exist
1681+ # Here we're using `unittest.main` which happens to be both a module and an attribute
1682+ reader .buffer = list ("from unittest import m" )
1683+ reader .pos = len (reader .buffer )
1684+ names , action = reader .get_module_completions ()
1685+ self .assertEqual (names , [
1686+ f"{ type_color } main{ R } " , # Ensure that `main` is colored as an attribute (class in this case)
1687+ f"{ module_color } mock{ R } " ,
1688+ ])
1689+ self .assertIsNone (action )
1690+
16781691
16791692# Audit hook used to check for stdlib modules import side-effects
16801693# Defined globally to avoid adding one hook per test run (refleak)
You can’t perform that action at this time.
0 commit comments