diff --git a/test/t/test_python.py b/test/t/test_python.py index f9fdfa4b72d..102280d30d0 100644 --- a/test/t/test_python.py +++ b/test/t/test_python.py @@ -46,22 +46,41 @@ def test_9(self, completion): def test_bb(self, completion): assert "-bb" in completion + @pytest.mark.complete("python foo ", cwd="python") + def test_script_args(self, completion): + assert "bar.txt" in completion + + @pytest.mark.complete("python -- foo ", cwd="python") + def test_script_args_with_double_hyphen(self, completion): + assert "bar.txt" in completion + @pytest.mark.complete("python -m foo bar -p ", cwd="python") - def test_script_args_1(self, completion): + def test_module_args(self, completion): assert "bar.txt" in completion - @pytest.mark.complete("python -mfoo bar -p ", cwd="python") - def test_script_args_2(self, completion): + @pytest.mark.complete("python foo bar -p ", cwd="python") + def test_script_args_after_option(self, completion): assert "bar.txt" in completion - @pytest.mark.complete("python -- foo ", cwd="python") - def test_script_args_3(self, completion): + @pytest.mark.complete("python -- foo bar -p ", cwd="python") + def test_script_args_after_option_with_double_hyphen(self, completion): + assert "bar.txt" in completion + + @pytest.mark.complete("python -m foo bar -p ", cwd="python") + def test_module_args_after_option(self, completion): + assert "bar.txt" in completion + + @pytest.mark.complete("python -mfoo bar -p ", cwd="python") + def test_module_args_after_option_with_connected_m_arg(self, completion): assert "bar.txt" in completion @pytest.mark.complete("python -- ", cwd="python") - def test_script_args_4(self, completion): + def test_script_name(self, completion): assert "bar.txt" not in completion @pytest.mark.complete("python -W -mfoo ", cwd="python") - def test_script_args_5(self, completion): + def test_fake_module_args_with_w_arg(self, completion): + """In this case, -mfoo looks like an option to specify the module, but + it should not be treated as the module name because it is an option + argument to -W.""" assert "bar.txt" not in completion