aaron-y-chen commented on code in PR #58543:
URL: https://github.com/apache/airflow/pull/58543#discussion_r4147264926
##########
airflow-core/tests/unit/timetables/test_assets_timetable.py:
##########
@@ -130,6 +163,114 @@ def core_asset_timetable(test_timetable: MockTimetable)
-> CoreAssetOrTimeSchedu
)
[email protected](
+ ("timetable", "expected"),
+ [
+ pytest.param(MockTimetable(), (False, False), id="core-regular"),
+ pytest.param(
+ AssetTriggeredTimetable(SerializedAsset("test_asset",
"test://asset/", "asset", {}, [])),
+ (True, False),
+ id="core-asset-triggered",
+ ),
+ pytest.param(
+ CoreAssetOrTimeSchedule(
+ timetable=MockTimetable(),
+ assets=SerializedAsset("test_asset", "test://asset/", "asset",
{}, []),
+ ),
+ (True, False),
+ id="core-asset-or-time",
+ ),
+ pytest.param(
+ CoreAssetAndTimeSchedule(
+ timetable=MockTimetable(),
+ assets=SerializedAsset("test_asset", "test://asset/", "asset",
{}, []),
+ ),
+ (False, True),
+ id="core-asset-and-time",
+ ),
+ pytest.param(BaseTimetable(), (False, False), id="sdk-regular"),
+ pytest.param(
+ SdkAssetTriggeredTimetable(assets=Asset("test")),
+ (True, False),
+ id="sdk-asset-triggered",
+ ),
+ pytest.param(
+ SdkAssetOrTimeSchedule(timetable=BaseTimetable(),
assets=Asset("test")),
+ (True, False),
+ id="sdk-asset-or-time",
+ ),
+ pytest.param(
+ SdkAssetAndTimeSchedule(timetable=BaseTimetable(),
assets=Asset("test")),
+ (False, True),
+ id="sdk-asset-and-time",
+ ),
+ ],
+)
+def test_asset_scheduling_behavior_flags(timetable, expected) -> None:
+ assert (timetable.asset_triggered, timetable.asset_gated) == expected
+
+
[email protected](
+ ("outer_type", "inner_type"),
+ [
+ pytest.param(
+ CoreAssetOrTimeSchedule,
+ CustomAssetTriggeredTimetable,
+ id="or-wraps-custom-asset-triggered",
+ ),
+ pytest.param(
+ CoreAssetOrTimeSchedule,
+ CustomAssetGatedTimetable,
+ id="or-wraps-custom-asset-gated",
+ ),
+ pytest.param(
+ CoreAssetAndTimeSchedule,
+ CustomAssetTriggeredTimetable,
+ id="and-wraps-custom-asset-triggered",
+ ),
+ pytest.param(
+ CoreAssetAndTimeSchedule,
+ CustomAssetGatedTimetable,
+ id="and-wraps-custom-asset-gated",
+ ),
+ ],
+)
Review Comment:
Nice simplification!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]