示例#1
0
 def test_method_chaining(self):
     request = AsyncJobRequest(service="test")
     request.add_input(value="s3://bucket/test.txt").add_output(
         value="s3://bucket/test.txt"
     ).add_parameter(value="bar").add_parameter(
         name="-p", value="baz"
     ).add_output_metadata(
         {"foo": "bar"}
     )
     assert len(request.req_args["parameters"]) == 4
     assert request.req_args["parameters"][0]["type"] == "input"
     assert request.req_args["parameters"][1]["type"] == "output"
     assert request.req_args["parameters"][2]["type"] == "parameter"
     assert request.req_args["parameters"][2]["value"] == "bar"
     assert request.req_args["parameters"][2]["type"] == "parameter"
     assert request.req_args["parameters"][3]["name"] == "-p"
     assert request.req_args["parameters"][3]["value"] == "baz"
     assert request.req_args["outputMetadata"]["foo"] == "bar"
示例#2
0
 def test_add_input_warn(self):
     request = AsyncJobRequest(service="test")
     with pytest.warns(UserWarning):
         request.add_input(value="foo")