Skip to content

Commit

Permalink
respect default_value in loadable input check (#6771)
Browse files Browse the repository at this point in the history
## Test Plan

added test
  • Loading branch information
alangenfeld committed Feb 23, 2022
1 parent 2b6ded6 commit e53dec4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,7 @@ def _checked_input_resource_reqs_for_mode(
not input_def.dagster_type.loader
and not input_def.dagster_type.kind == DagsterTypeKind.NOTHING
and not input_def.root_manager_key
and not input_def.has_default_value
):
raise DagsterInvalidDefinitionError(
"Input '{input_name}' in {described_node} is not connected to "
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from typing import Optional

import pytest
from dagster import (
DagsterInvalidDefinitionError,
InputDefinition,
Nothing,
Optional,
composite_solid,
execute_pipeline,
execute_solid,
job,
lambda_solid,
op,
pipeline,
)

Expand Down Expand Up @@ -171,3 +174,19 @@ def outter_wrap(z):
result = execute_solid(outter_wrap)
assert result.success
assert result.output_value() == 42


def test_custom_type_default():
class CustomType:
pass

@op
def test_op(inp: Optional[CustomType] = None):
return 1

@job
def test_job():
test_op()

result = test_job.execute_in_process()
assert result.output_for_node("test_op") == 1

0 comments on commit e53dec4

Please sign in to comment.