Skip to content

Commit

Permalink
Move input tests before output tests
Browse files Browse the repository at this point in the history
Order the tests from input to output.
  • Loading branch information
kinghuang committed Aug 21, 2020
1 parent f255529 commit a1fb909
Showing 1 changed file with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@ def create_dask_df():
return dd.read_csv(path)


@pytest.mark.parametrize(
'file_type',
[
pytest.param('csv', id='csv'),
pytest.param('parquet', id='parquet'),
pytest.param('json', id='json'),
],
)
def test_dataframe_inputs(file_type):
@solid(input_defs=[InputDefinition(dagster_type=DataFrame, name='input_df')])
def return_df(_, input_df):
return input_df

file_name = file_relative_path(__file__, f"num.{file_type}")
result = execute_solid(
return_df,
run_config={
'solids': {'return_df': {'inputs': {'input_df': {file_type: {'path': file_name}}}}}
},
)
assert result.success
assert assert_eq(result.output_value(), create_dask_df())


@pytest.mark.parametrize(
'file_type,read,kwargs',
[
Expand Down Expand Up @@ -44,27 +68,3 @@ def return_df(_):
assert result.success
actual = read(f"{temp_path}/*")
assert assert_eq(actual, df)


@pytest.mark.parametrize(
'file_type',
[
pytest.param('csv', id='csv'),
pytest.param('parquet', id='parquet'),
pytest.param('json', id='json'),
],
)
def test_dataframe_inputs(file_type):
@solid(input_defs=[InputDefinition(dagster_type=DataFrame, name='input_df')])
def return_df(_, input_df):
return input_df

file_name = file_relative_path(__file__, f"num.{file_type}")
result = execute_solid(
return_df,
run_config={
'solids': {'return_df': {'inputs': {'input_df': {file_type: {'path': file_name}}}}}
},
)
assert result.success
assert assert_eq(result.output_value(), create_dask_df())

0 comments on commit a1fb909

Please sign in to comment.