def test_infer_descriptions_from_docstring_numpy(): @solid def good_numpy(_context, hello: str, optional: int = 5): """ Test Parameters ---------- hello: hello world param optional: optional param, default 5 """ return hello + str(optional) defs = inference.infer_input_definitions_for_solid(good_numpy.name, good_numpy.compute_fn) assert len(defs) == 2 hello_param = defs[0] assert hello_param.name == "hello" assert hello_param.dagster_type.unique_name == "String" assert hello_param.description == "hello world param" optional_param = defs[1] assert optional_param.name == "optional" assert optional_param.dagster_type.unique_name == "Int" assert optional_param.default_value == 5 assert optional_param.description == "optional param, default 5"
def test_infer_descriptions_from_docstring_google(): @solid def good_google(_context, hello: str, optional: int = 5): """ Test Args: hello (str): hello world param optional (int, optional): optional param. Defaults to 5. """ return hello + str(optional) defs = inference.infer_input_definitions_for_solid(good_google.name, good_google.compute_fn) assert len(defs) == 2 hello_param = defs[0] assert hello_param.name == "hello" assert hello_param.dagster_type.unique_name == "String" assert hello_param.description == "hello world param" optional_param = defs[1] assert optional_param.name == "optional" assert optional_param.dagster_type.unique_name == "Int" assert optional_param.default_value == 5 assert optional_param.description == "optional param. Defaults to 5."
def test_infer_input_description_from_docstring_rest(): @solid def rest(_context, hello: str, optional: int = 5): """ :param str hello: hello world param :param int optional: optional param, defaults to 5 """ return hello + str(optional) defs = inference.infer_input_definitions_for_solid(rest.name, rest.compute_fn) assert len(defs) == 2 hello_param = defs[0] assert hello_param.name == "hello" assert hello_param.dagster_type.unique_name == "String" optional_param = defs[1] assert optional_param.name == "optional" assert optional_param.dagster_type.unique_name == "Int" assert optional_param.default_value == 5