Skip to content

Commit 8e5b5ff

Browse files
committed
Improved patch coverage
1 parent 675a214 commit 8e5b5ff

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/input/input_python.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,12 @@ impl<'py> Input<'py> for Bound<'py, PyAny> {
292292
}
293293

294294
if self.is_instance_of::<PyComplex>() {
295-
if !strict {
296-
if let Ok(real) = self.getattr(intern!(self.py(), "real")) {
297-
if let Ok(float) = real.extract::<f64>() {
298-
return Ok(ValidationMatch::lax(EitherFloat::F64(float)));
299-
}
300-
}
301-
} else {
295+
if strict {
302296
return Err(ValError::new(ErrorTypeDefaults::FloatType, self));
303297
}
298+
let real = self.getattr(intern!(self.py(), "real")).unwrap();
299+
let float = real.extract::<f64>().unwrap();
300+
return Ok(ValidationMatch::lax(EitherFloat::F64(float)));
304301
}
305302

306303
if !strict {

0 commit comments

Comments
 (0)