`Constant` constraint not enforced in `Union`
Open
component: core
type: bug
- Dominant language
- Python
- Stars
- 462
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
`Constant` constraint is not enforced when initializing `Union` (came up in writing tests for #1298)
```python
class TestClass(HasTraits):
attribute = Union(None, Constant(123))
a = TestClass(attribute=456) # No exception raised
a.attribute # 456
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.