summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChase Sterling <chase.sterling@gmail.com>2013-04-05 20:10:56 -0400
committerChase Sterling <chase.sterling@gmail.com>2013-04-05 20:10:56 -0400
commit832f51cd23b1fa0714e224658723aa4222f51817 (patch)
treed20498bf2b72070de4068a5cb38ee2725d54a978 /docs
parent1a74234680e6f0c26f6af7aa38f52de948641fe7 (diff)
downloadjsonschema-832f51cd23b1fa0714e224658723aa4222f51817.tar.gz
Don't rely on hash sorting for docs examples
Diffstat (limited to 'docs')
-rw-r--r--docs/errors.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/errors.rst b/docs/errors.rst
index 4fd00a0..f965eda 100644
--- a/docs/errors.rst
+++ b/docs/errors.rst
@@ -62,7 +62,7 @@ These attributes can be clarified with a short example:
... }
>>> instance = [{}, 3, "foo"]
>>> v = Draft4Validator(schema)
- >>> errors = list(v.iter_errors(instance))
+ >>> errors = sorted(v.iter_errors(instance), key=lambda e: e.path)
The error messages in this situation are not very helpful on their own:
@@ -103,7 +103,7 @@ the schema each of these errors come from. In the case of sub-errors from the
.. code-block:: python
>>> for e in errors:
- ... for sube in e.context:
+ ... for sube in sorted(e.context, key=lambda e: e.schema_path:
... print list(sube.schema_path), sube
[0, 'type'] {} is not of type 'string'
[1, 'type'] {} is not of type 'integer'