Skip to content
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 in a set validation doesn't lead to type coercion #400

Open
rawrgulmuffins opened this issue Jul 22, 2019 · 0 comments
Open

Coerce in a set validation doesn't lead to type coercion #400

rawrgulmuffins opened this issue Jul 22, 2019 · 0 comments

Comments

@rawrgulmuffins
Copy link

Issue Statement

When doing a coercion on a singleton or list the expected type casting is done. In the case of a set the original type is returned and no exception is raised.

Expectation

Either sets can't do coercions and a schema error is raised or sets correctly return a set with the modified types.

Steps to reproduction

from ipaddress import IPv4Address
from voluptuous import Coerce, Schema

test_schema = Schema(Coerce(IPv4Address))
test_schema('192.0.0.2')
# Returns IPv4Address('192.0.0.2')
test_schema = Schema([Coerce(IPv4Address)])
test_schema(['192.0.0.2'])
# Returns [IPv4Address('192.0.0.2')]
test_schema = Schema({Coerce(IPv4Address)})
test_schema({'192.0.0.2'})
# Returns {'192.0.0.2'}
>>>

Versions

PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
Python==3.7.2
voluptuous==0.11.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant