Skip to content

Commit

Permalink
better testcode grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
loechel committed Feb 21, 2017
1 parent f5910e7 commit 7788263
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/usage/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The general workflow to execute Python code that is loaded within a Python progr

With RestrictedPython that workflow should be as straight forward as possible:

.. testcode:: Python
.. testcode::

from RestrictedPython import compile_restricted

Expand All @@ -33,7 +33,7 @@ With RestrictedPython that workflow should be as straight forward as possible:

You might also use the replacement import:

.. testcode:: Python
.. testcode::

from RestrictedPython import compile_restricted as compile

Expand Down
8 changes: 5 additions & 3 deletions docs/usage/framework_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ For that use case RestrictedPython provides the possibility to pass an own polic

A policy is basically a special ``NodeTransformer`` that could be instantiated with three params for ``errors``, ``warnings`` and ``used_names``, it should be a subclass of RestrictedPython.RestrictingNodeTransformer.

.. testcode:: Python
.. testcode:: own_policy

from RestrictedPython import compile_restricted
from RestrictedPython import RestrictingNodeTransformer
Expand All @@ -49,7 +49,7 @@ A policy is basically a special ``NodeTransformer`` that could be instantiated w

All ``compile_restricted*`` methods do have a optional parameter ``policy``, where a specific policy could be provided.

.. testcode:: Python
.. testcode:: own_policy

source_code = """
def do_something():
Expand All @@ -69,7 +69,9 @@ All ``compile_restricted*`` methods do have a optional parameter ``policy``, whe
One special case "unrestricted RestrictedPython" (defined to unblock ports of Zope Packages to Python 3) is to actually use RestrictedPython in an unrestricted mode, by providing a Null-Policy (aka ``None``).
That special case would be written as:

.. testcode:: Python
.. testcode::

from RestrictedPython import compile_restricted

source_code = """
def do_something():
Expand Down

0 comments on commit 7788263

Please sign in to comment.