summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAndrey Lebedev <andrey@lebedev.lt>2013-02-19 19:04:48 +0200
committerAndrey Lebedev <andrey@lebedev.lt>2013-02-19 19:04:48 +0200
commitaad857434f77e494a9c1ea1ba90f95bb1cc60551 (patch)
tree12dd3b098beccd00325eb818ccf4432a6dd601fb /docs
parent7434c4686c573946feb81dcba0a670e17013a29c (diff)
downloadzope-security-aad857434f77e494a9c1ea1ba90f95bb1cc60551.tar.gz
Use python3.3 to run documentation testsmoretests
Diffstat (limited to 'docs')
-rw-r--r--docs/api/checker.rst79
-rw-r--r--docs/api/permission.rst10
-rw-r--r--docs/api/zcml.rst3
3 files changed, 10 insertions, 82 deletions
diff --git a/docs/api/checker.rst b/docs/api/checker.rst
index 4bf5dc7..58d3595 100644
--- a/docs/api/checker.rst
+++ b/docs/api/checker.rst
@@ -224,15 +224,6 @@ Rocks are immuatle, non-callable objects without interesting methods. They
>>> int(type(ProxyFactory( True )) is type(True))
1
-Additionally, check some python-2.x specific types.
-
-.. doctest::
- >>> from zope.security._compat import PYTHON2
- >>> int(type(ProxyFactory( long(1) )) is long) if PYTHON2 else 1
- 1
- >>> int(type(ProxyFactory( u'xxx' )) is unicode) if PYTHON2 else 1
- 1
-
Datetime-reltatd instances are rocks, too:
.. doctest::
@@ -264,7 +255,6 @@ We can do everything we expect to be able to do with proxied dicts.
.. doctest::
- >>> from zope.security._compat import PYTHON2
>>> d = ProxyFactory({'a': 1, 'b': 2})
>>> check_forbidden_get(d, 'clear') # Verify that we are protected
'ForbiddenAttribute: clear'
@@ -297,29 +287,12 @@ We can do everything we expect to be able to do with proxied dicts.
[1, 2]
>>> sorted(d.items())
[('a', 1), ('b', 2)]
- >>> sorted(d.iterkeys()) if PYTHON2 else ['a', 'b']
- ['a', 'b']
- >>> sorted(d.itervalues()) if PYTHON2 else [1, 2]
- [1, 2]
- >>> sorted(d.iteritems()) if PYTHON2 else [('a', 1), ('b', 2)]
- [('a', 1), ('b', 2)]
Always available (note, that dicts in python-3.x are not orderable, so we are
not checking that under python > 2):
.. doctest::
- >>> from zope.security._compat import PYTHON2
- >>> int(d < d) if PYTHON2 else 0
- 0
- >>> int(d > d) if PYTHON2 else 0
- 0
- >>> int(d <= d) if PYTHON2 else 1
- 1
- >>> int(d >= d) if PYTHON2 else 1
- 1
- >>> int(d == d) if PYTHON2 else 1
- 1
>>> int(d != d)
0
>>> int(bool(d))
@@ -876,15 +849,6 @@ Always available:
.. doctest::
- >>> from zope.security._compat import PYTHON2
- >>> int(C < C) if PYTHON2 else 0
- 0
- >>> int(C > C) if PYTHON2 else 0
- 0
- >>> int(C <= C) if PYTHON2 else 1
- 1
- >>> int(C >= C) if PYTHON2 else 1
- 1
>>> int(C == C)
1
>>> int(C != C)
@@ -916,15 +880,6 @@ Always available:
.. doctest::
- >>> from zope.security._compat import PYTHON2
- >>> int(c < c) if PYTHON2 else 0
- 0
- >>> int(c > c) if PYTHON2 else 0
- 0
- >>> int(c <= c) if PYTHON2 else 1
- 1
- >>> int(c >= c) if PYTHON2 else 1
- 1
>>> int(c == c)
1
>>> int(c != c)
@@ -940,7 +895,6 @@ Classic Classes
.. doctest::
- >>> from zope.security._compat import PYTHON2
>>> class C:
... x = 1
>>> C = ProxyFactory(C)
@@ -952,22 +906,13 @@ Classic Classes
>>> s = repr(C)
>>> int(C.__module__ == __name__)
1
- >>> len(C.__bases__) if PYTHON2 else 0
- 0
+ >>> len(C.__bases__)
+ 1
Always available:
.. doctest::
- >>> from zope.security._compat import PYTHON2
- >>> int(C < C) if PYTHON2 else 0
- 0
- >>> int(C > C) if PYTHON2 else 0
- 0
- >>> int(C <= C) if PYTHON2 else 1
- 1
- >>> int(C >= C) if PYTHON2 else 1
- 1
>>> int(C == C)
1
>>> int(C != C)
@@ -996,15 +941,6 @@ Always available:
.. doctest::
- >>> from zope.security._compat import PYTHON2
- >>> int(c < c) if PYTHON2 else 0
- 0
- >>> int(c > c) if PYTHON2 else 0
- 0
- >>> int(c <= c) if PYTHON2 else 1
- 1
- >>> int(c >= c) if PYTHON2 else 1
- 1
>>> int(c == c)
1
>>> int(c != c)
@@ -1078,20 +1014,11 @@ Always available:
.. doctest::
- >>> from zope.security._compat import PYTHON2
- >>> int(PBar < PBar) if PYTHON2 else 0
- 0
- >>> int(PBar > PBar) if PYTHON2 else 0
- 0
- >>> int(PBar <= PBar) if PYTHON2 else 1
- 1
- >>> int(PBar >= PBar) if PYTHON2 else 1
- 1
>>> int(PBar == PBar)
1
>>> int(PBar != PBar)
0
>>> int(bool(PBar))
1
- >>> int(PBar.__class__ == abc.ABCMeta) if PYTHON2 else 1
+ >>> int(PBar.__class__ == type)
1
diff --git a/docs/api/permission.rst b/docs/api/permission.rst
index 64a4250..819cc90 100644
--- a/docs/api/permission.rst
+++ b/docs/api/permission.rst
@@ -48,7 +48,7 @@ The :data:`zope.security.checker.CheckerPublic` permission always exists:
>>> ids = list(allPermissions(None))
>>> ids.sort()
>>> ids
- [u'x', u'y']
+ ['x', 'y']
.. autofunction:: zope.security.permission.PermissionsVocabulary
@@ -100,9 +100,9 @@ The non-public permissions 'x' and 'y' are string values:
.. doctest::
>>> vocab.getTermByToken('x').value
- u'x'
+ 'x'
>>> vocab.getTermByToken('y').value
- u'y'
+ 'y'
However, the public permission value is CheckerPublic:
@@ -116,7 +116,7 @@ and its title is shortened:
.. doctest::
>>> vocab.getTermByToken('zope.Public').title
- u'Public'
+ 'Public'
The terms are sorted by title except for the public permission, which is
listed first:
@@ -124,7 +124,7 @@ listed first:
.. doctest::
>>> [term.title for term in vocab]
- [u'Public', u'x', u'y']
+ ['Public', 'x', 'y']
.. testcleanup::
diff --git a/docs/api/zcml.rst b/docs/api/zcml.rst
index 7c03405..a23075a 100644
--- a/docs/api/zcml.rst
+++ b/docs/api/zcml.rst
@@ -11,8 +11,9 @@ a couple of permissions:
>>> from zope.component import getGlobalSiteManager
>>> from zope.configuration.xmlconfig import XMLConfig
+ >>> from zope.component.testing import setUp
>>> import zope.security
-
+ >>> setUp() # clear global component registry
>>> XMLConfig('permissions.zcml', zope.security)()
>>> len(list(getGlobalSiteManager().registeredUtilities()))