From 832f51cd23b1fa0714e224658723aa4222f51817 Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Fri, 5 Apr 2013 20:10:56 -0400 Subject: Don't rely on hash sorting for docs examples --- docs/errors.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') 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' -- cgit v1.2.1