Skip to content

Commit c00dbab

Browse files
committed
Add type checking test
1 parent 3ea025d commit c00dbab

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/nexus/test_type_checking.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import nexusrpc
2+
3+
import temporalio.nexus
4+
from temporalio import workflow
5+
6+
7+
def _():
8+
@nexusrpc.handler.service_handler
9+
class MyService:
10+
@nexusrpc.handler.sync_operation
11+
async def my_sync_operation(
12+
self, ctx: nexusrpc.handler.StartOperationContext, input: int
13+
) -> str:
14+
raise NotImplementedError
15+
16+
@temporalio.nexus.workflow_run_operation
17+
async def my_workflow_run_operation(
18+
self, ctx: temporalio.nexus.WorkflowRunOperationContext, input: int
19+
) -> temporalio.nexus.WorkflowHandle[str]:
20+
raise NotImplementedError
21+
22+
@workflow.defn(sandboxed=False)
23+
class MyWorkflow:
24+
@workflow.run
25+
async def invoke_nexus_op_and_assert_error(self) -> None:
26+
self.nexus_client = workflow.create_nexus_client(
27+
service=MyService,
28+
endpoint="fake-endpoint",
29+
)
30+
await self.nexus_client.execute_operation(MyService.my_sync_operation, 1)
31+
await self.nexus_client.execute_operation(
32+
MyService.my_workflow_run_operation, 1
33+
)

0 commit comments

Comments
 (0)