#[cfg(test)]
mod tests {
use pyo3::prelude::*;
use pyo3::types::IntoPyDict;
#[test]
fn asdf() -> PyResult<()> {
Python::with_gil(|py| {
let plt = py.import("matplotlib.pyplot")?;
let np = py.import("numpy")?;
let locals = [("np", np), ("plt", plt)].into_py_dict(py);
let x: Vec<f64> = py
.eval("np.linspace(-6, 6, 100)", None, Some(&locals))?
.extract()?;
let y: Vec<f64> = x.iter().cloned().map(|x| x.cos()).collect();
locals.set_item("x", x)?;
locals.set_item("y", y)?;
py.eval("plt.plot(x, y)", None, Some(&locals))?;
py.eval("plt.savefig('/tmp/qwer.png')", None, Some(&locals))?;
Ok(())
})
}
}