Skip to content

u prefix in error messages in Python 2 when schema is loaded from file #751

@abitrolly

Description

@abitrolly

Given.

$  cat schema.json
{
    "type" : "object",
    "properties" : {
        "price" : {"type" : "number"},
        "name" : {"type" : "string"}
    }
}

$ cat sample.json
{"name" : "Eggs", "price" : "xxx"}

When running with Python 2, the error message prefixes each field with u.

$ jsonschema -i sample.json schema.json 
xxx: u'xxx' is not of type u'number'

For Python 3 there is no u prefix.

xxx: 'xxx' is not of type 'number'

That's was the reason of tests failure in Poetry - https://github.com/python-poetry/poetry-core/pull/99/checks?check_run_id=1236052810

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions