Skip to content

Commit 16ec13c

Browse files
committed
Use python 3 style prints in docs
1 parent cf7056d commit 16ec13c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

docs/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@
6767
# A list of ignored prefixes for module index sorting.
6868
#modindex_common_prefix = []
6969

70-
doctest_global_setup = "from jsonschema import *"
70+
doctest_global_setup = (
71+
"from __future__ import print_function\n"
72+
"from jsonschema import *"
73+
)
7174

7275

7376
# -- Options for HTML output ---------------------------------------------------

docs/errors.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The error messages in this situation are not very helpful on their own:
6969
.. code-block:: python
7070
7171
>>> for e in errors:
72-
... print e.message
72+
... print(e.message)
7373
The instance is not valid under any of the given schemas
7474
The instance is not valid under any of the given schemas
7575
The instance is not valid under any of the given schemas
@@ -82,7 +82,7 @@ will be the index in our list.
8282
.. code-block:: python
8383
8484
>>> for e in errors:
85-
... print list(e.path)
85+
... print(list(e.path))
8686
[0]
8787
[1]
8888
[2]
@@ -104,7 +104,7 @@ the schema each of these errors come from. In the case of sub-errors from the
104104
105105
>>> for e in errors:
106106
... for sube in sorted(e.context, key=lambda e: e.schema_path):
107-
... print list(sube.schema_path), sube
107+
... print(list(sube.schema_path), sube)
108108
[0, 'type'] {} is not of type 'string'
109109
[1, 'type'] {} is not of type 'integer'
110110
[0, 'type'] 3 is not of type 'string'
@@ -149,7 +149,7 @@ For clarity's sake, the given instance has three errors under this schema:
149149
150150
>>> v = Draft3Validator(schema)
151151
>>> for error in sorted(v.iter_errors(["spam", 2]), key=str):
152-
... print error
152+
... print(error)
153153
'spam' is not of type 'number'
154154
'spam' is not one of [1, 2, 3]
155155
['spam', 2] is too short

0 commit comments

Comments
 (0)