enthought / enthought/traits

Traits not checking interface instance attribute is implementer of specified interface

Open
#454 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
462
Forks
90
PR merge metrics
No merged PRs in 30d

Description

According to http://docs.enthought.com/traits/traits_user_manual/advanced.html#using-interfaces

> Using an interface class with an Instance trait definition declares that the trait accepts only values that implement the specified interface

Yet, I can do something like the following without error:

```python
from traits.api import *

class IThing(Interface):
x = Int

@provides(IThing)
class Thing(HasTraits):
x = Int

class Nothing(HasTraits):
thing = Instance(IThing)

if __name__ == '__main__':
n = Nothing()
n.thing = 'anything', u'', 'want', '!!', 11

```

Am I misunderstanding the docs or is this a bug?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.