>>> from interfaces import *
>>> class IFoo(interface):
... def foo( self, a, b, c ):
... """Does a foo"""
...
>>> @implements(IFoo)
... class Foo(object):
... pass
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "interfaces/__init__.py", line 46, in implementsDecorator
raise MissingInterfaceMethodException( newClass, functionName, interfaceClass )
interfaces.MissingInterfaceMethodException: Foo does not implement 'foo' from IFoo
>>> @implements(IFoo)
... class Foo(object):
... def foo( self ):
... pass
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "interfaces/__init__.py", line 58, in implementsDecorator
newClass, implementSig )
interfaces.IncompatibleMethodException: Foo implements foo( self ) but IFoo expects foo( self, a, b, c )
>>> @implements(IFoo)
... class Foo(object):
... def foo( self, a, b, c ):
... pass
...
>>> f = Foo( )
>>> help(f.foo)
Help on method foo in module __main__:
foo(self, a, b, c) method of __main__.Foo instance
Does a foo
-
Notifications
You must be signed in to change notification settings - Fork 0
theojulienne/PythonInterfaces
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published