import pytest from scripts.mma_exec import create_parser def test_parser_role_choices(): """Test that the parser accepts valid roles and the prompt argument.""" parser = create_parser() valid_roles = ['tier1', 'tier2', 'tier3', 'tier4'] test_prompt = "Analyze the codebase for bottlenecks." for role in valid_roles: args = parser.parse_args(['--role', role, test_prompt]) assert args.role == role assert args.prompt == test_prompt def test_parser_invalid_role(): """Test that the parser rejects roles outside the specified choices.""" parser = create_parser() with pytest.raises(SystemExit): parser.parse_args(['--role', 'tier5', 'Some prompt']) def test_parser_prompt_required(): """Test that the prompt argument is mandatory.""" parser = create_parser() with pytest.raises(SystemExit): parser.parse_args(['--role', 'tier3']) def test_parser_help(): """Test that the help flag works without raising errors (exits with 0).""" parser = create_parser() with pytest.raises(SystemExit) as excinfo: parser.parse_args(['--help']) assert excinfo.value.code == 0