Open
Description
When we set up a driver for the JSON front end, we have something like the following:
expected_outcome_effects = {
"Positive": Positive(),
"Negative": Negative(),
"NoEffect": NoEffect(),
"SomeEffect": SomeEffect()
}
This works great for this kind of effects, but when I want to test for exact values, I have:
expected_outcome_effects = {
"Positive": Positive(),
"Negative": Negative(),
"NoEffect": NoEffect(),
"SomeEffect": SomeEffect(),
"1.0": ExactValue(1.0),
"0.8": ExactValue(0.8),
"0.7": ExactValue(0.7),
"0.65": ExactValue(0.65),
"0.6": ExactValue(0.6),
"0.5": ExactValue(0.5),
"-0.01": ExactValue(-0.01),
}
This is expanding as I need to add more literal values. Could we perhaps use a function instead, so I could have something like
def expanded_outcome_effects(effect):
if effect == "Positive":
return Positive()
elif effect == "Negative":
return Negative():
else:
return ExactValue(float(effect))
or would that be bad?
Metadata
Metadata
Assignees
Labels
No labels