Add a basic rust test in

This commit is contained in:
Tom 2025-02-19 15:08:21 +00:00
parent bb61e6fe7c
commit 1ca23ca4cf
2 changed files with 23 additions and 3 deletions

View File

@ -1,7 +1,24 @@
// #![allow(unused_imports)]
#![allow(unused_imports)]
// #![allow(dead_code)]
// #![allow(unused_variables)]
use pyo3::prelude::*;
use pyo3::wrap_pyfunction;
use pyo3::types::{PyDict, PyInt, PyList, PyString};
#[pyfunction]
fn hello(_py: Python, name: &str) -> PyResult<String> {
Ok(format!("Hello, {}!", name))
}
#[pymodule]
fn rust(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction!(hello, m)?).unwrap();
Ok(())
}
// use rsfdb::listiterator::KeyValueLevel;
// use rsfdb::request::Request;
// use rsfdb::FDB;
@ -9,8 +26,6 @@
// use serde_json::{json, Value};
// use std::time::Instant;
// use pyo3::prelude::*;
// use pyo3::types::{PyDict, PyInt, PyList, PyString};
// use std::collections::HashMap;

5
tests/test_rust.py Normal file
View File

@ -0,0 +1,5 @@
from qubed.rust import hello
def test_hello():
assert hello("World") == "Hello, World!"