From 05874d3f1a26b99abafebcdb33b836368dc9c145 Mon Sep 17 00:00:00 2001 From: konstin Date: Thu, 27 Sep 2018 01:11:13 +0200 Subject: [PATCH] Fix tests --- examples/rustapi_module/src/lib.rs | 6 +++--- examples/rustapi_module/src/othermod.rs | 6 +++--- src/object.rs | 5 ++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/examples/rustapi_module/src/lib.rs b/examples/rustapi_module/src/lib.rs index e75f692b..98ca10fc 100644 --- a/examples/rustapi_module/src/lib.rs +++ b/examples/rustapi_module/src/lib.rs @@ -213,9 +213,9 @@ fn datetime(_py: Python, m: &PyModule) -> PyResult<()> { // Python 3.6+ functions #[cfg(Py_3_6)] { - m.add_function(wrap_function!(time_with_fold)); - m.add_function(wrap_function!(get_time_tuple_fold)); - m.add_function(wrap_function!(get_datetime_tuple_fold)); + m.add_function(wrap_function!(time_with_fold))?; + m.add_function(wrap_function!(get_time_tuple_fold))?; + m.add_function(wrap_function!(get_datetime_tuple_fold))?; } m.add_function(wrap_function!(issue_219))?; diff --git a/examples/rustapi_module/src/othermod.rs b/examples/rustapi_module/src/othermod.rs index 049ed097..6a06f26e 100644 --- a/examples/rustapi_module/src/othermod.rs +++ b/examples/rustapi_module/src/othermod.rs @@ -18,12 +18,12 @@ impl ModClass { #[pyfunction] fn double(x: i32) -> i32 { - x*2 + x * 2 } #[pymodinit] -fn datetime(_py: Python, m: &PyModule) -> PyResult<()> { +fn othermod(_py: Python, m: &PyModule) -> PyResult<()> { m.add_function(wrap_function!(double))?; m.add_class::()?; Ok(()) -} \ No newline at end of file +} diff --git a/src/object.rs b/src/object.rs index 85b564ab..025c5bd7 100644 --- a/src/object.rs +++ b/src/object.rs @@ -338,7 +338,10 @@ mod test { let py = gil.python(); let obj: PyObject = PyDict::new(py).into(); assert!(obj.call_method0(py, "asdf").is_err()); - assert!(obj.call_method(py, "nonexistent_method", (1,), None).is_err()); + assert!( + obj.call_method(py, "nonexistent_method", (1,), None) + .is_err() + ); assert!(obj.call_method0(py, "nonexistent_method").is_err()); assert!(obj.call_method1(py, "nonexistent_method", (1,)).is_err()); }