#![cfg(feature = "python")]
use std::{collections::HashSet, path::PathBuf};
#[test]
fn pyclass_renames_are_used_in_stub_generation() {
use kittycad_modeling_cmds::format;
let _ = std::any::TypeId::of::<format::dxf::export::Options>();
let _ = std::any::TypeId::of::<format::obj::import::Options>();
let _ = std::any::TypeId::of::<format::obj::export::Options>();
let _ = std::any::TypeId::of::<format::stl::import::Options>();
let _ = std::any::TypeId::of::<format::stl::export::Options>();
let info = pyo3_stub_gen::StubInfo::from_project_root(
"kittycad_modeling_cmds".to_string(),
PathBuf::from(env!("CARGO_MANIFEST_DIR")),
)
.expect("stub info should be collectable with python feature enabled");
let mut names = HashSet::new();
for module in info.modules.values() {
eprintln!("module {}", module.name);
for class in module.class.values() {
eprintln!(" class {}", class.name);
names.insert(class.name);
}
}
for expected in [
"DxfExportOptions",
"ObjImportOptions",
"ObjExportOptions",
"StlImportOptions",
"StlExportOptions",
] {
assert!(
names.contains(expected),
"expected renamed class `{}` to appear in stub info; got {:?}",
expected,
names
);
}
}