New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coerce on List elements produces unexpect results #161

Closed
proximous opened this Issue Oct 12, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@proximous
Copy link

proximous commented Oct 12, 2015

Slight modification of the example at: http://cerberus.readthedocs.org/en/latest/usage.html

schema = {'a_list': {'type': 'list', 'schema': {'type': 'float', 'coerce': float}}}
document = {'a_list': [3, 4, 5]}
v.validated(document, schema)
>>> {0: 3.0, 1: 4.0, 2: 5.0, 'a_list': [3, 4, 5]}

I would expect:

>>> {'a_list': [3.0, 4.0, 5.0]}

Is this the intended behavior or a bug?

@funkyfuture

This comment has been minimized.

Copy link
Member

funkyfuture commented Oct 13, 2015

funkyfuture added a commit to funkyfuture/cerberus that referenced this issue Oct 16, 2015

Fixes coercion with schema on sequences
also
- removes some unnecessary variable assignments
- changes how coercion within a valueschema is done, no more interferes with configuration

solves pyeve#161

funkyfuture added a commit to funkyfuture/cerberus that referenced this issue Oct 16, 2015

Fixes coercion with schema on sequences
also
- removes some unnecessary variable assignments
- changes how coercion within a valueschema is done, no more interferes with configuration

solves pyeve#161
@proximous

This comment has been minimized.

Copy link

proximous commented Oct 18, 2015

Patch 165 from @funkyfuture fixes this issue. Many thanks!

nicolaiarocci added a commit that referenced this issue Oct 19, 2015

Fixes coercion with schema on sequences
also
- removes some unnecessary variable assignments
- changes how coercion within a valueschema is done, no more interferes with configuration

solves #161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment