You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Constant constraint is not enforced when initializing Union (came up in writing tests for #1298)
classTestClass(HasTraits):
attribute=Union(None, Constant(123))
a=TestClass(attribute=456) # No exception raiseda.attribute# 456
The text was updated successfully, but these errors were encountered:
k2bd
changed the title
validate method of Constant is permissive; constraint not enforced in UnionConstant constraint not enforced in Union initialization
Apr 9, 2024
k2bd
changed the title
Constant constraint not enforced in Union initializationConstant constraint not enforced in UnionApr 9, 2024
No validation -> I think this may be a need for some additional validation logic in Union's __init__. I think this isn't directly related to Constant but to a lack of validation in Union (though simply adding validation at the moment I think would cause issues specifically with Constant; see Scenario 2)
Scenario 2: Set value on an existing HasTraits object w/ Union trait
Constant
constraint is not enforced when initializingUnion
(came up in writing tests for #1298)The text was updated successfully, but these errors were encountered: