Fix tests

This commit is contained in:
konstin 2018-09-27 01:11:13 +02:00
parent b850ca3e6d
commit 05874d3f1a
3 changed files with 10 additions and 7 deletions

View File

@ -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))?;

View File

@ -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::<ModClass>()?;
Ok(())
}
}

View File

@ -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());
}