File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1509,6 +1509,13 @@ def _apply_to_class(
15091509 f"Multiple update methods found for { defn_name } "
15101510 f"(at least on { name } and { updates [update_defn .name ].fn .__name__ } )"
15111511 )
1512+ elif update_defn .validator and not _parameters_identical_up_to_naming (
1513+ update_defn .fn , update_defn .validator
1514+ ):
1515+ issues .append (
1516+ f"Update validator method { update_defn .validator .__name__ } parameters "
1517+ f"do not match update method { update_defn .fn .__name__ } parameters"
1518+ )
15121519 else :
15131520 updates [update_defn .name ] = update_defn
15141521
Original file line number Diff line number Diff line change @@ -418,3 +418,26 @@ def test_workflow_init_not__init__():
418418 with pytest .raises (ValueError ) as err :
419419 workflow .init (BadWorkflowInit .not__init__ )
420420 assert "@workflow.init may only be used on the __init__ method" in str (err .value )
421+
422+
423+ class BadUpdateValidator :
424+ @workflow .update
425+ def my_update (self , a : str ):
426+ pass
427+
428+ @my_update .validator # type: ignore
429+ def my_validator (self , a : int ):
430+ pass
431+
432+ @workflow .run
433+ async def run (self ):
434+ pass
435+
436+
437+ def test_workflow_update_validator_not_update ():
438+ with pytest .raises (ValueError ) as err :
439+ workflow .defn (BadUpdateValidator )
440+ assert (
441+ "Update validator method my_validator parameters do not match update method my_update parameters"
442+ in str (err .value )
443+ )
You can’t perform that action at this time.
0 commit comments