Skip to content

Commit 1e90065

Browse files
committed
Refactor
1 parent 962202a commit 1e90065

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

tests/test_client.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,24 +1345,22 @@ def update_search_attributes(
13451345
print("empty-but-non-none-clears")
13461346
# Pass empty but non-None to clear all attributes
13471347
return ScheduleUpdate(
1348-
input.description.schedule, search_attributes=TypedSearchAttributes([])
1348+
input.description.schedule,
1349+
search_attributes=TypedSearchAttributes.empty,
13491350
)
13501351
elif test_case == "all-new-values-overwrites":
13511352
print("all-new-values-overwrites")
13521353
# Pass all new values to overwrite existing
13531354
return ScheduleUpdate(
13541355
input.description.schedule,
1355-
search_attributes=TypedSearchAttributes(
1356-
[
1357-
SearchAttributePair(key_1, val_1 + "-new"),
1358-
SearchAttributePair(key_2, val_2 + "-new"),
1359-
]
1356+
search_attributes=input.description.typed_search_attributes.updated(
1357+
SearchAttributePair(key_1, val_1 + "-new"),
1358+
SearchAttributePair(key_2, val_2 + "-new"),
13601359
),
13611360
)
13621361
elif test_case == "partial-new-values-overwrites-and-drops":
13631362
print("partial-new-values-overwrites-and-drops")
13641363
# Only update key_1, which should drop key_2
1365-
input.description.typed_search_attributes.updated
13661364
return ScheduleUpdate(
13671365
input.description.schedule,
13681366
search_attributes=TypedSearchAttributes(
@@ -1376,7 +1374,7 @@ def update_search_attributes(
13761374

13771375
await handle.update(update_search_attributes)
13781376

1379-
async def none_is_noop_expectations():
1377+
async def none_is_noop_expectations() -> bool:
13801378
desc = await handle.describe()
13811379
return (
13821380
desc.search_attributes[key_1.name] == [val_1]
@@ -1385,16 +1383,18 @@ async def none_is_noop_expectations():
13851383
and desc.typed_search_attributes[key_2] == val_2
13861384
)
13871385

1388-
async def empty_but_non_none_clears_expectations():
1386+
async def empty_but_non_none_clears_expectations() -> bool:
13891387
desc = await handle.describe()
1390-
return (
1391-
desc.search_attributes[key_1.name] == []
1392-
and desc.search_attributes[key_2.name] == []
1393-
and len(desc.typed_search_attributes) == 0
1394-
and len(desc.search_attributes) == 0
1388+
return_ = (
1389+
desc.search_attributes[key_1.name] == [],
1390+
desc.search_attributes[key_2.name] == [],
1391+
len(desc.typed_search_attributes) == 0,
1392+
len(desc.search_attributes) == 0,
13951393
)
1394+
print(return_)
1395+
return all(return_)
13961396

1397-
async def all_new_values_overwrite_expectations():
1397+
async def all_new_values_overwrite_expectations() -> bool:
13981398
desc = await handle.describe()
13991399
return (
14001400
desc.search_attributes[key_1.name] == [val_1 + "-new"]
@@ -1403,7 +1403,7 @@ async def all_new_values_overwrite_expectations():
14031403
and desc.typed_search_attributes[key_2] == val_2 + "-new"
14041404
)
14051405

1406-
async def partial_new_values_overwrites_and_drops_expectations():
1406+
async def partial_new_values_overwrites_and_drops_expectations() -> bool:
14071407
desc = await handle.describe()
14081408
return (
14091409
desc.search_attributes[key_1.name] == [val_1 + "-new"]

0 commit comments

Comments
 (0)