Skip to content

Commit

Permalink
fix test flags are not properly built.
Browse files Browse the repository at this point in the history
  • Loading branch information
CatB1t committed Jan 8, 2023
1 parent 3f25062 commit 9cea3db
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions ivy_tests/test_ivy/helpers/test_parameter_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,27 @@ class AsVariableFlags: # TODO remove
BuiltAsVariableStrategy = st.lists(st.booleans(), min_size=1, max_size=1)
BuiltContainerStrategy = st.lists(st.booleans(), min_size=1, max_size=1)
BuiltInstanceStrategy = st.booleans()
BuiltWithOutStrategy = st.booleans()
BuiltGradientStrategy = st.booleans()
BuiltWithOutStrategy = st.booleans()


flags_mapping = {
"as_variable": "_BuiltAsVariable",
"native_array": "_BuiltNativeArray",
"container": "_BuiltContainer",
"with_out": "_BuiltWithOut",
"instance_method": "_BuiltInstance",
"test_gradients": "_BuiltGradient",
"native_array": "BuiltNativeArrayStrategy",
"as_variable": "BuiltAsVariableStrategy",
"container": "BuiltContainerStrategy",
"instance_method": "BuiltInstanceStrategy",
"test_gradients": "BuiltGradientStrategy",
"with_out": "BuiltWithOutStrategy",
}


def build_flag(key: str, value: bool):
if value is not None:
value = st.just(value)
# Prevent silently passing if variables names were changed
assert flags_mapping[key] in globals().keys(), (
f"{flags_mapping[key]} is not " f"a valid flag variable."
)
globals()[flags_mapping[key]] = value


Expand Down

0 comments on commit 9cea3db

Please sign in to comment.