/usr/share/doc/python-contract/examples/testdbc8.py is in python-contract 1.4-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #!/usr/bin/env python
"""
Test class-private variables.
>>> f = Foo()
>>> f.__attr
Traceback (most recent call last):
...
AttributeError: Foo instance has no attribute '__attr'
"""
class Foo:
"""inv: self._Foo__attr > 0"""
def __init__(self):
self.__attr = 1
def _test():
import contract, doctest, testdbc8
contract.checkmod(testdbc8)
return doctest.testmod(testdbc8)
if __name__ == '__main__':
t = _test()
if t[0]:
print "test: %d/%d failures" % t
import sys
sys.exit( 1 )
else:
print "test: %d successes" % t[1]
|