python-fastjsonschema icon indicating copy to clipboard operation
python-fastjsonschema copied to clipboard

Nameerror when I use `numpy.nan` as default

Open anandhs opened this issue 4 years ago • 0 comments

When I default to numpy.nan, i get a NameError: name 'nan' is not defined.

Here is the full code

import fastjsonschema
import numpy as np

nnnan = np.nan
print(nnnan)
validate = fastjsonschema.compile({
    'type': 'object',
    'properties': {
        'a': {'type': 'number', 'default': np.nan},
    },
})

data = validate({})
assert data == {'a': np.nan}

anandhs avatar May 26 '20 19:05 anandhs