Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
briantu committed Oct 21, 2024
1 parent 41914e8 commit 7bf9c80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
two_parents_daily = two_parents.with_asset_properties(partitions_def=daily_partitions)


@pytest.mark.asyncio
@pytest.mark.parametrize(
["expected_value_hash", "condition", "scenario_spec", "materialize_A"],
[
Expand All @@ -51,16 +52,16 @@
("7f852ab7408c67e0830530d025505a37", SC.missing(), one_parent_daily, False),
],
)
def test_value_hash(
async def test_value_hash(
condition: SC, scenario_spec: ScenarioSpec, expected_value_hash: str, materialize_A: bool
) -> None:
state = AutomationConditionScenarioState(
scenario_spec, automation_condition=condition
).with_current_time("2024-01-01T00:00")

state, _ = state.evaluate("downstream")
state, _ = await state.evaluate("downstream")
if materialize_A:
state = state.with_runs(run_request("A"))

state, result = state.evaluate("downstream")
state, result = await state.evaluate("downstream")
assert result.value_hash == expected_value_hash
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _get_request_subsets_by_key(
for asset_key, aps in ap_by_key.items()
}

def evaluate(
async def evaluate(
self, asset: CoercibleToAssetKey
) -> Tuple["AutomationConditionScenarioState", AutomationResult]:
asset_key = AssetKey.from_coercible(asset)
Expand Down Expand Up @@ -100,7 +100,7 @@ def evaluate(
) # type: ignore
context = AutomationContext.create(key=asset_key, evaluator=evaluator)

full_result = asset_condition.evaluate(context)
full_result = await asset_condition.evaluate(context) # type: ignore
new_state = dataclasses.replace(self, condition_cursor=full_result.get_new_cursor())
result = full_result.child_results[0] if self.ensure_empty_result else full_result

Expand Down

0 comments on commit 7bf9c80

Please sign in to comment.