Skip to content

Commit dd32fc0

Browse files
Improve enum validation test cases for decimal values
1 parent 36ce3ba commit dd32fc0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/validators/literal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl<T: Debug> LiteralLookup<T> {
182182
return Ok(None);
183183
};
184184

185-
if py_input.is_instance(get_decimal_type(py)).is_err() {
185+
if let Ok(false) = py_input.is_instance(get_decimal_type(py)) {
186186
return Ok(None);
187187
}
188188

tests/validators/test_enums.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,3 +377,6 @@ class MyEnum(Enum):
377377
)
378378
with pytest.raises(ValidationError):
379379
v.validate_python(Decimal(2))
380+
381+
with pytest.raises(ValidationError):
382+
v.validate_python((1, 2))

0 commit comments

Comments
 (0)