@@ -346,4 +346,43 @@ def test_retry_fail_for_unsupported_state():
346346 c1 = Choice ('My Choice' )
347347
348348 with pytest .raises (ValueError ):
349- c1 .add_catch (Catch (error_equals = ["States.NoChoiceMatched" ], next_step = Fail ("ChoiceFailed" )))
349+ c1 .add_catch (Catch (error_equals = ["States.NoChoiceMatched" ], next_step = Fail ("ChoiceFailed" )))
350+
351+
352+ def test_paths_none ():
353+ task_state = Task ('Task' , resource = 'arn:aws:lambda:us-east-1:1234567890:function:StartLambda' ,
354+ result_path = None ,
355+ input_path = None ,
356+ output_path = None )
357+ assert 'ResultPath' in task_state .to_dict ()
358+ assert task_state .to_dict ()['ResultPath' ] is None
359+
360+ assert 'InputPath' in task_state .to_dict ()
361+ assert task_state .to_dict ()['InputPath' ] is None
362+
363+ assert 'OutputPath' in task_state .to_dict ()
364+ assert task_state .to_dict ()['OutputPath' ] is None
365+
366+
367+ def test_paths_none_converted_to_null ():
368+ task_state = Task ('Task' , resource = 'arn:aws:lambda:us-east-1:1234567890:function:StartLambda' ,
369+ result_path = None ,
370+ input_path = None ,
371+ output_path = None )
372+ assert '"ResultPath": null' in task_state .to_json ()
373+ assert '"InputPath": null' in task_state .to_json ()
374+ assert '"OutputPath": null' in task_state .to_json ()
375+
376+
377+ def test_default_paths_not_included ():
378+ task_state = Task ('Task' , resource = 'arn:aws:lambda:us-east-1:1234567890:function:StartLambda' )
379+ assert 'ResultPath' not in task_state .to_dict ()
380+ assert 'InputPath' not in task_state .to_dict ()
381+ assert 'OutputPath' not in task_state .to_dict ()
382+
383+
384+ def test_default_paths_not_converted_to_null ():
385+ task_state = Task ('Task' , resource = 'arn:aws:lambda:us-east-1:1234567890:function:StartLambda' )
386+ assert '"ResultPath": null' not in task_state .to_json ()
387+ assert '"InputPath": null' not in task_state .to_json ()
388+ assert '"OutputPath": null' not in task_state .to_json ()
0 commit comments