The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(google-workspace): type and shrink empty Gmail search regression test
unsupportedpastelsaf8839df1038
diff --git a/skills/productivity/google-workspace/scripts/google_api.py b/skills/productivity/google-workspace/scripts/google_api.pyindex 5a9d0839f67..3276e54e20a 100644--- a/skills/productivity/google-workspace/scripts/google_api.py+++ b/skills/productivity/google-workspace/scripts/google_api.py@@ -275,7 +275,7 @@ def build_service(api, version):# =========================================================================-def gmail_search(args):+def gmail_search(args: argparse.Namespace) -> None:if _gws_binary():results = _run_gws(["gmail", "users", "messages", "list"],diff --git a/tests/skills/test_google_workspace_api.py b/tests/skills/test_google_workspace_api.pyindex e7d6aaedb6e..51329e3a91a 100644--- a/tests/skills/test_google_workspace_api.py+++ b/tests/skills/test_google_workspace_api.py@@ -197,26 +197,16 @@ def test_api_get_credentials_refresh_persists_authorized_user_type(api_module, massert saved["type"] == "authorized_user"-def test_gmail_search_empty_result_prints_json_array(api_module, capsys):- """Regression for #131711: an empty Gmail search through the Python- fallback printed "No messages found." instead of the JSON array the gws- backend emits, breaking consumers that parse search output as JSON."""-- class EmptyGmail:- def users(self):- return self-- def messages(self):- return self-- def list(self, **_kwargs):- return self-- def execute(self):- return {"resultSizeEstimate": 0}-- api_module._gws_binary = lambda: None- api_module.build_service = lambda *_args, **_kwargs: EmptyGmail()+def test_gmail_search_empty_result_prints_json_array(+ api_module: types.ModuleType,+ monkeypatch: pytest.MonkeyPatch,+ capsys: pytest.CaptureFixture[str],+) -> None:+ """Python-fallback empty search prints [] like the gws path (#131711)."""+ service = MagicMock()+ service.users().messages().list().execute.return_value = {"resultSizeEstimate": 0}+ monkeypatch.setattr(api_module, "_gws_binary", lambda: None)+ monkeypatch.setattr(api_module, "build_service", lambda *_args: service)api_module.gmail_search(api_module.argparse.Namespace(query="is:unread", max=10))