Skip to content

Commit 832f51c

Browse files
committed
Don't rely on hash sorting for docs examples
1 parent 1a74234 commit 832f51c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/errors.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ These attributes can be clarified with a short example:
6262
... }
6363
>>> instance = [{}, 3, "foo"]
6464
>>> v = Draft4Validator(schema)
65-
>>> errors = list(v.iter_errors(instance))
65+
>>> errors = sorted(v.iter_errors(instance), key=lambda e: e.path)
6666
6767
The error messages in this situation are not very helpful on their own:
6868

@@ -103,7 +103,7 @@ the schema each of these errors come from. In the case of sub-errors from the
103103
.. code-block:: python
104104
105105
>>> for e in errors:
106-
... for sube in e.context:
106+
... for sube in sorted(e.context, key=lambda e: e.schema_path:
107107
... print list(sube.schema_path), sube
108108
[0, 'type'] {} is not of type 'string'
109109
[1, 'type'] {} is not of type 'integer'

0 commit comments

Comments
 (0)