Skip to content

Commit

Permalink
update user_flags to user_overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Aug 24, 2024
1 parent 267061b commit 8fc6485
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions dbt_common/behavior_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class RawBehaviorFlag(TypedDict):

def register(
behavior_flags: List[RawBehaviorFlag],
user_flags: Dict[str, Any],
user_overrides: Dict[str, Any],
) -> Behavior:
flags = {}
for raw_flag in behavior_flags:
Expand All @@ -84,8 +84,8 @@ def register(
}

# specifically evaluate for `None` since `False` and `None` should be treated differently
if user_flags.get(raw_flag["name"]) is not None:
flag["setting"] = user_flags.get(raw_flag["name"])
if user_overrides.get(raw_flag["name"]) is not None:
flag["setting"] = user_overrides[raw_flag["name"]]

event = BehaviorDeprecationEvent(
flag_name=raw_flag["name"],
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/test_behavior_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_behavior_default():
{"name": "default_false_flag", "default": False},
{"name": "default_true_flag", "default": True},
],
user_flags={},
user_overrides={},
)

assert behavior.default_false_flag.setting is False
Expand All @@ -31,7 +31,7 @@ def test_behavior_user_override():
{"name": "flag_default_true_override_false", "default": True},
{"name": "flag_default_true_override_true", "default": True},
],
user_flags={
user_overrides={
"flag_default_false_override_false": False,
"flag_default_false_override_true": True,
"flag_default_true_override_false": False,
Expand All @@ -53,7 +53,7 @@ def test_behavior_flag_can_be_used_as_conditional():
{"name": "flag_false", "default": False},
{"name": "flag_true", "default": True},
],
user_flags={},
user_overrides={},
)

assert False if behavior.flag_false else True
Expand All @@ -75,7 +75,7 @@ def test_behavior_flags_emit_deprecation_event_on_evaluation(event_catcher) -> N
{"name": "flag_false", "default": False},
{"name": "flag_true", "default": True},
],
user_flags={},
user_overrides={},
)

# trigger the evaluation, no event should fire
Expand All @@ -92,7 +92,7 @@ def test_behavior_flags_emit_deprecation_event_on_evaluation(event_catcher) -> N
def test_behavior_flags_emit_correct_deprecation(event_catcher) -> None:
behavior = register(
behavior_flags=[{"name": "flag_false", "default": False}],
user_flags={},
user_overrides={},
)

# trigger the evaluation
Expand All @@ -110,7 +110,7 @@ def test_behavior_flags_no_deprecation_event_on_no_warn(event_catcher) -> None:
behavior_flags=[
{"name": "flag_false", "default": False},
],
user_flags={},
user_overrides={},
)

# trigger the evaluation with no_warn, no event should fire
Expand Down

0 comments on commit 8fc6485

Please sign in to comment.