!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.16 (Debian). PHP/5.3.3-7+squeeze19 

uname -a: Linux mail.tri-specialutilitydistrict.com 2.6.32-5-amd64 #1 SMP Tue May 13 16:34:35 UTC
2014 x86_64
 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/share/pyshared/zope/interface/   drwxr-xr-x
Free 130 GB of 142.11 GB (91.48%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     verify.txt (2.98 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
===================================
Verifying interface implementations
===================================

The ``zope.interface.verify`` module provides functions that test whether a
given interface is implemented by a class or provided by an object, resp.


Verifying classes
=================

This is covered by unit tests defined in ``zope.interface.tests.test_verify``.


Verifying objects
=================

An object provides an interface if

- either its class declares that it implements the interfaces, or the object
  declares that it directly provides the interface

- the object defines all the methods required by the interface

- all the methods have the correct signature

- the object defines all non-method attributes required by the interface

This doctest currently covers only the latter item.

Testing for attributes
----------------------

Attributes of the object, be they defined by its class or added by its
``__init__`` method, will be recognized:

>>> from zope.interface import Interface, Attribute, implements
>>> class IFoo(Interface):
...     x = Attribute("The X attribute")
...     y = Attribute("The Y attribute")

>>> class Foo(object):
...     implements(IFoo)
...     x = 1
...     def __init__(self):
...         self.y = 2

>>> from zope.interface.verify import verifyObject
>>> verifyObject(IFoo, Foo())
True

If either attribute is missing, verification will fail:

>>> class Foo(object):
...     implements(IFoo)
...     x = 1

>>> verifyObject(IFoo, Foo())
Traceback (most recent call last):
BrokenImplementation: An object has failed to implement interface <InterfaceClass __builtin__.IFoo>
    The y attribute was not provided.

>>> class Foo(object):
...     implements(IFoo)
...     def __init__(self):
...         self.y = 2

>>> verifyObject(IFoo, Foo())
Traceback (most recent call last):
BrokenImplementation: An object has failed to implement interface <InterfaceClass __builtin__.IFoo>
    The x attribute was not provided.

If an attribute is implemented as a property that raises an AttributeError
when trying to get its value, the attribute is considered missing:

>>> class IFoo(Interface):
...     x = Attribute('The X attribute')

>>> class Foo(object):
...     implements(IFoo)
...     @property
...     def x(self):
...         raise AttributeError

>>> verifyObject(IFoo, Foo())
Traceback (most recent call last):
BrokenImplementation: An object has failed to implement interface <InterfaceClass __builtin__.IFoo>
    The x attribute was not provided.

Any other exception raised by a property will propagate to the caller of
``verifyObject``:

>>> class Foo(object):
...     implements(IFoo)
...     @property
...     def x(self):
...         raise Exception

>>> verifyObject(IFoo, Foo())
Traceback (most recent call last):
Exception

Of course, broken properties that are not required by the interface don't do
any harm:

>>> class Foo(object):
...     implements(IFoo)
...     x = 1
...     @property
...     def y(self):
...         raise Exception

>>> verifyObject(IFoo, Foo())
True

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0163 ]--