Implement __eq__ for FeatureFlag so that they are compared by name & variant, rather than by object identity
This is primarily to make the unit tests easier to write but could also be helpful in callbacks for the same reasons — it makes comparing feature flags easier:
flag1 = FeatureFlag('a', '1')
flag2 = FeatureFlag('b', '2')
# without this change:
flags_are_equal = flag1.name == flag2.name and flag1.variant == flag2.variant
# with this change:
flags_are_equal = flag1 == flag2
Goal
Implement
__eq__
forFeatureFlag
so that they are compared by name & variant, rather than by object identityThis is primarily to make the unit tests easier to write but could also be helpful in callbacks for the same reasons — it makes comparing feature flags easier: