Skip to content

Commit ec6be31

Browse files
committed
Change options to expexted
1 parent 1ef03d6 commit ec6be31

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/errors/types.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub enum ErrorType {
161161
// ---------------------
162162
// enum errors
163163
Enum {
164-
options: String,
164+
expected: String,
165165
},
166166
// ---------------------
167167
// dict errors
@@ -420,7 +420,7 @@ impl ErrorType {
420420
Self::IterationError { .. } => extract_context!(IterationError, ctx, error: String),
421421
Self::StringTooShort { .. } => extract_context!(StringTooShort, ctx, min_length: usize),
422422
Self::StringTooLong { .. } => extract_context!(StringTooLong, ctx, max_length: usize),
423-
Self::Enum { .. } => extract_context!(Enum, ctx, options: String),
423+
Self::Enum { .. } => extract_context!(Enum, ctx, expected: String),
424424
Self::StringPatternMismatch { .. } => extract_context!(StringPatternMismatch, ctx, pattern: String),
425425
Self::MappingType { .. } => extract_context!(Cow::Owned, MappingType, ctx, error: String),
426426
Self::BytesTooShort { .. } => extract_context!(BytesTooShort, ctx, min_length: usize),
@@ -498,7 +498,7 @@ impl ErrorType {
498498
Self::StringTooShort {..} => "String should have at least {min_length} characters",
499499
Self::StringTooLong {..} => "String should have at most {max_length} characters",
500500
Self::StringPatternMismatch {..} => "String should match pattern '{pattern}'",
501-
Self::Enum {..} => "Input should be {options}",
501+
Self::Enum {..} => "Input should be {expected}",
502502
Self::DictType => "Input should be a valid dictionary",
503503
Self::MappingType {..} => "Input should be a valid mapping, error: {error}",
504504
Self::ListType => "Input should be a valid list",
@@ -635,7 +635,7 @@ impl ErrorType {
635635
Self::StringTooShort { min_length } => to_string_render!(tmpl, min_length),
636636
Self::StringTooLong { max_length } => to_string_render!(tmpl, max_length),
637637
Self::StringPatternMismatch { pattern } => render!(tmpl, pattern),
638-
Self::Enum { options } => to_string_render!(tmpl, options),
638+
Self::Enum { expected } => to_string_render!(tmpl, expected),
639639
Self::MappingType { error } => render!(tmpl, error),
640640
Self::BytesTooShort { min_length } => to_string_render!(tmpl, min_length),
641641
Self::BytesTooLong { max_length } => to_string_render!(tmpl, max_length),
@@ -695,7 +695,7 @@ impl ErrorType {
695695
Self::StringTooShort { min_length } => py_dict!(py, min_length),
696696
Self::StringTooLong { max_length } => py_dict!(py, max_length),
697697
Self::StringPatternMismatch { pattern } => py_dict!(py, pattern),
698-
Self::Enum { options } => py_dict!(py, options),
698+
Self::Enum { expected } => py_dict!(py, expected),
699699
Self::MappingType { error } => py_dict!(py, error),
700700
Self::BytesTooShort { min_length } => py_dict!(py, min_length),
701701
Self::BytesTooLong { max_length } => py_dict!(py, max_length),

tests/test_errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def f(input_value, info):
191191
('invalid_key', 'Keys should be strings', None),
192192
('get_attribute_error', 'Error extracting attribute: foo', {'error': 'foo'}),
193193
('none_required', 'Input should be None', None),
194-
('enum', 'Input should be foo', {'options': 'foo'}),
194+
('enum', 'Input should be foo', {'expected': 'foo'}),
195195
('greater_than', 'Input should be greater than 42.1', {'gt': 42.1}),
196196
('greater_than', 'Input should be greater than 42.1', {'gt': '42.1'}),
197197
('greater_than', 'Input should be greater than 2020-01-01', {'gt': '2020-01-01'}),

0 commit comments

Comments
 (0)