diff --git a/voluptuous/validators.py b/voluptuous/validators.py index 3981e96..d895dba 100644 --- a/voluptuous/validators.py +++ b/voluptuous/validators.py @@ -283,10 +283,10 @@ class Union(_WithSubValidators): >>> validate = Schema(Union({'type':'a', 'a_val':'1'},{'type':'b', 'b_val':'2'}, ... discriminant=lambda val, alt: filter( ... lambda v : v['type'] == val['type'] , alt))) - >>> validate({'type':'a', 'val':'1'}) - True + >>> validate({'type':'a', 'a_val':'1'}) + {'a_val': '1', 'type': 'a'} >>> with raises(MultipleInvalid, "not a valid value for dictionary value @ data['b_val']"): - ... validate({'type':'b', 'a_val':'5'}) + ... validate({'type':'b', 'b_val':'5'}) ```discriminant({'type':'b', 'a_val':'5'}, [{'type':'a', 'a_val':'1'},{'type':'b', 'b_val':'2'}])``` is invoked