diff --git a/temporalio/workflow.py b/temporalio/workflow.py index 2d4617cb..e35ebee3 100644 --- a/temporalio/workflow.py +++ b/temporalio/workflow.py @@ -526,9 +526,9 @@ def random() -> Random: def upsert_search_attributes(attributes: temporalio.common.SearchAttributes) -> None: """Upsert search attributes for this workflow. - The keys will be added/replaced on top of the existing search attributes in - the same manner as :py:meth:`dict.update`. :py:attr:`Info.search_attributes` - will also be updated with these values. + The keys will be added or replaced on top of the existing search attributes + in the same manner as :py:meth:`dict.update`. + :py:attr:`Info.search_attributes` will also be updated with these values. Technically an existing search attribute cannot be deleted, but an empty list can be provided for the values which is effectively the same thing. diff --git a/tests/worker/test_workflow.py b/tests/worker/test_workflow.py index 97f2d87f..188f4e54 100644 --- a/tests/worker/test_workflow.py +++ b/tests/worker/test_workflow.py @@ -1197,11 +1197,11 @@ async def test_workflow_search_attributes(server: ExternalServer, client: Client if not server.supports_custom_search_attributes: pytest.skip("Custom search attributes not supported") - # Add search attributes if not already present async def search_attributes_present() -> bool: resp = await client.service.get_search_attributes(GetSearchAttributesRequest()) return any(k for k in resp.keys.keys() if k.startswith(sa_prefix)) + # Add search attributes if not already present if not await search_attributes_present(): async with grpc.aio.insecure_channel(server.host_port) as channel: stub = OperatorServiceStub(channel)