@@ -118,6 +118,7 @@ class MyService:
118
118
Input , Output
119
119
]
120
120
sync_operation_without_type_annotations : nexusrpc .interface .Operation [Input , Output ]
121
+ sync_operation_with_non_async_def : nexusrpc .interface .Operation [Input , Output ]
121
122
non_retryable_application_error : nexusrpc .interface .Operation [Input , Output ]
122
123
retryable_application_error : nexusrpc .interface .Operation [Input , Output ]
123
124
check_operation_timeout_header : nexusrpc .interface .Operation [Input , Output ]
@@ -224,6 +225,12 @@ async def async_operation(
224
225
options = options ,
225
226
)
226
227
228
+ @nexusrpc .handler .sync_operation
229
+ def sync_operation_with_non_async_def (
230
+ self , input : Input , options : nexusrpc .handler .StartOperationOptions
231
+ ) -> Output :
232
+ return Output (value = f"from start method: { input .value } " )
233
+
227
234
@nexusrpc .handler .sync_operation
228
235
async def sync_operation_without_type_annotations (self , input , options ):
229
236
return Output (
@@ -376,6 +383,15 @@ class SyncHandlerHappyPath(_TestCase):
376
383
# "Nexus-Link header not echoed correctly."
377
384
378
385
386
+ class SyncHandlerHappyPathNonAsyncDef (_TestCase ):
387
+ operation = "sync_operation_with_non_async_def"
388
+ input = Input ("hello" )
389
+ expected_response = SuccessfulResponse (
390
+ status_code = 200 ,
391
+ body_json = {"value" : "from start method: hello" },
392
+ )
393
+
394
+
379
395
class SyncHandlerHappyPathWithoutTypeAnnotations (_TestCase ):
380
396
operation = "sync_operation_without_type_annotations"
381
397
input = Input ("hello" )
@@ -502,6 +518,7 @@ class OperationError(_FailureTestCase):
502
518
"test_case" ,
503
519
[
504
520
SyncHandlerHappyPath ,
521
+ SyncHandlerHappyPathNonAsyncDef ,
505
522
SyncHandlerHappyPathWithoutTypeAnnotations ,
506
523
AsyncHandlerHappyPath ,
507
524
AsyncHandlerHappyPathWithoutTypeAnnotations ,
0 commit comments